import express from 'express' ; import { BaseResult } from './BaseResult' ; import { OutgoingHttpHeaders } from 'http' ; export class EndResult < D > extends BaseResult { constructor ( public readonly data , public readonly encoding ? , public readonly status = 200 , public readonly headers ? ) { super ( ) ; } async execute ( req , res , next ) { if ( this . headers != null ) { res . set ( this . headers ) ; } if ( this . encoding != null ) { return res . status ( this . status ) . end ( this . data , this . encoding ) ; } return res . status ( this . status ) . end ( this . data ) ; } }