import http from 'http' ; import EventEmitter from 'events' ; export class HttpDuplex extends EventEmitter { setHeader ( arg0 , arg1 ) { throw new Error ( 'Method not implemented.' ) ; } end ( reason ? ) { throw new Error ( 'Method not implemented.' ) ; } destroy ( ) { throw new Error ( 'Method not implemented.' ) ; } accept ( ) { throw new Error ( 'Method not implemented.' ) ; } reject ( code , msg ) { throw new Error ( 'Method not implemented.' ) ; } see https see https req : http . IncomingMessage ; see https see https res : http . ServerResponse ; cwd : string | undefined ; repo : string | undefined ; exists : boolean | undefined ; see https see https see https example constructor ( input , output ) { super ( ) ; this . req = input ; this . res = output ; [ 'data' , 'end' , 'error' , 'close' ] . forEach ( ( name ) => { this . req . on ( name , this . emit . bind ( this , name ) ) ; } ) ; [ 'error' , 'drain' ] . forEach ( ( name ) => { this . res . on ( name , this . emit . bind ( this , name ) ) ; } ) ; } get complete ( ) { return this . req . complete ; } readonly see https get connection ( ) { return this . req . connection ; } readonly see https get headers ( ) { return this . req . headers ; } see https readonly get httpVersion ( ) { return this . req . httpVersion ; } see httpVersion readonly get httpVersionMajor ( ) { return this . req . httpVersionMajor ; } see httpVersion readonly get httpVersionMinor ( ) { return this . req . httpVersionMinor ; } see https see https example readonly get method ( ) { return this . req . method ; } readonly get readable ( ) { return this . req . readable ; } see https readonly get socket ( ) { return this . req . socket ; } see https example get statusCode ( ) { return this . res . statusCode ; } set statusCode ( val ) { this . res . statusCode = val ; } see https example get statusMessage ( ) { return this . res . statusMessage ; } set statusMessage ( val ) { this . res . statusMessage = val ; } /**
     * Request/response trailer headers. Just like  headers except these are only written
     * after the initial response to the client.
     * This object is only populated at the 'end' event and only work if a 'transfer-encoding: chunked'
     * header is sent in the initial response.
     *  readonly see headers see addTrailers see https see https get trailers ( ) { return this . req . trailers ; } example example readonly get url ( ) { return this . req . url ; } get writable ( ) { return this . res . writable ; } param statusCode param statusMessage param headers see https example writeHead ( statusCode , statusMessage , headers ) { this . res . writeHead ( statusCode , statusMessage , headers ) ; return this ; } see uncork see https example cork ( ) { this . res . socket ?. cork ( ) ; return this ; } see cork see https uncork ( ) { this . res . socket ?. uncork ( ) ; return this ; } } [ 'pause' , 'resume' , 'setEncoding' ] . forEach ( function ( name ) { ( HttpDuplex . prototype as any ) [ name ] = function ( ) { return ( this . req as any ) [ name ] . apply ( this . req , Array . from ( arguments ) ) ; } ; } ) ; [ 'setDefaultEncoding' , 'write' , 'end' , 'flush' , 'writeHeader' , 'writeContinue' , 'setHeader' , 'getHeader' , 'removeHeader' , 'addTrailers' , ] . forEach ( function ( name ) { ( HttpDuplex . prototype as any ) [ name ] = function ( ) { return ( this . res as any ) [ name ] . apply ( this . res , Array . from ( arguments ) ) ; } ; } ) ; /**
 * Destroys object and it's bound streams
 */ HttpDuplex . prototype . destroy = function ( ) { this . req . destroy ( ) ; this . res . destroy ( ) ; } ;