@@ -3,8 +3,8 @@ import * as fs from 'fs-extra';
33import * as http from 'http' ;
44import * as https from 'https' ;
55import * as path from 'path' ;
6-
76import { parse } from 'url' ;
7+
88import { toHttpHeaders } from '../utils' ;
99import { OutgoingHttpHeaders } from 'http' ;
1010import { InternalServerError , NotFoundError } from '../errors/http' ;
@@ -15,8 +15,6 @@ export class Origin {
1515 private readonly type : 'http' | 'https' | 'file' | 'noop' = 'http' ;
1616
1717 constructor ( public readonly baseUrl : string = '' ) {
18- const regex = / ^ h t t p s ? : \/ \/ / ;
19-
2018 if ( ! baseUrl ) {
2119 this . type = 'noop' ;
2220 } else if ( / ^ h t t p : \/ \/ / . test ( baseUrl ) ) {
@@ -50,6 +48,7 @@ export class Origin {
5048 // Make sure error gets back to user
5149 const status = err . statusCode || StatusCodes . INTERNAL_SERVER_ERROR ;
5250 const reasonPhrase = err . reasonPhrase || 'Internal Server Error' ;
51+
5352 return {
5453 status : status ,
5554 statusDescription : reasonPhrase ,
@@ -144,9 +143,11 @@ export class Origin {
144143 } ) ;
145144 res . on ( 'error' , ( err : Error ) => reject ( err ) ) ;
146145 } ) ;
146+
147147 if ( request . body && request . body . data ) {
148148 req . write ( request . body . data ) ;
149149 }
150+
150151 req . end ( ) ;
151152 } ) ;
152153 }
0 commit comments