File tree Expand file tree Collapse file tree 2 files changed +10
-4
lines changed Expand file tree Collapse file tree 2 files changed +10
-4
lines changed Original file line number Diff line number Diff line change @@ -177,8 +177,12 @@ export class BehaviorRouter {
177177 res . setHeader ( key as string , value ) ;
178178 }
179179 }
180-
181- res . end ( response . body ) ;
180+
181+ if ( response . bodyEncoding === 'base64' ) {
182+ res . end ( Buffer . from ( response . body , 'base64' ) . toString ( 'utf-8' ) ) ;
183+ } else {
184+ res . end ( response . body ) ;
185+ }
182186 } catch ( err ) {
183187 this . handleError ( err , res ) ;
184188 return ;
Original file line number Diff line number Diff line change @@ -123,7 +123,7 @@ export class Origin {
123123 method : request . method ,
124124 protocol : baseUrl . protocol ,
125125 hostname : baseUrl . hostname ,
126- port : baseUrl . port || ( baseUrl . protocol === 'https:' ) ? 443 : 80 ,
126+ port : baseUrl . port || ( baseUrl . protocol === 'https:' ? 443 : 80 ) ,
127127 path : uri . path ,
128128 headers : {
129129 ...headers ,
@@ -144,7 +144,9 @@ export class Origin {
144144 } ) ;
145145 res . on ( 'error' , ( err : Error ) => reject ( err ) ) ;
146146 } ) ;
147-
147+ if ( request . body && request . body . data ) {
148+ req . write ( request . body . data ) ;
149+ }
148150 req . end ( ) ;
149151 } ) ;
150152 }
You can’t perform that action at this time.
0 commit comments