@@ -3,8 +3,8 @@ import * as fs from 'fs-extra';
3
3
import * as http from 'http' ;
4
4
import * as https from 'https' ;
5
5
import * as path from 'path' ;
6
-
7
6
import { parse } from 'url' ;
7
+
8
8
import { toHttpHeaders } from '../utils' ;
9
9
import { OutgoingHttpHeaders } from 'http' ;
10
10
import { InternalServerError , NotFoundError } from '../errors/http' ;
@@ -15,8 +15,6 @@ export class Origin {
15
15
private readonly type : 'http' | 'https' | 'file' | 'noop' = 'http' ;
16
16
17
17
constructor ( public readonly baseUrl : string = '' ) {
18
- const regex = / ^ h t t p s ? : \/ \/ / ;
19
-
20
18
if ( ! baseUrl ) {
21
19
this . type = 'noop' ;
22
20
} else if ( / ^ h t t p : \/ \/ / . test ( baseUrl ) ) {
@@ -50,6 +48,7 @@ export class Origin {
50
48
// Make sure error gets back to user
51
49
const status = err . statusCode || StatusCodes . INTERNAL_SERVER_ERROR ;
52
50
const reasonPhrase = err . reasonPhrase || 'Internal Server Error' ;
51
+
53
52
return {
54
53
status : status ,
55
54
statusDescription : reasonPhrase ,
@@ -144,9 +143,11 @@ export class Origin {
144
143
} ) ;
145
144
res . on ( 'error' , ( err : Error ) => reject ( err ) ) ;
146
145
} ) ;
146
+
147
147
if ( request . body && request . body . data ) {
148
148
req . write ( request . body . data ) ;
149
149
}
150
+
150
151
req . end ( ) ;
151
152
} ) ;
152
153
}
0 commit comments