File tree Expand file tree Collapse file tree 2 files changed +3
-2
lines changed Expand file tree Collapse file tree 2 files changed +3
-2
lines changed Original file line number Diff line number Diff line change 99 makeResponse,
1010 EACH_MATRIX
1111} = require ( '../jest-helpers' )
12-
1312const jestHelpersPath = path . join ( __dirname , '..' , 'jest-helpers' )
1413
1514let app , router , serverlessExpressInstance
Original file line number Diff line number Diff line change @@ -12,13 +12,15 @@ function getString (data) {
1212 return data . toString ( 'utf8' )
1313 } else if ( typeof data === 'string' ) {
1414 return data
15+ } else if ( data instanceof Uint8Array ) {
16+ return new TextDecoder ( ) . decode ( data )
1517 } else {
1618 throw new Error ( `response.write() of unexpected type: ${ typeof data } ` )
1719 }
1820}
1921
2022function addData ( stream , data ) {
21- if ( Buffer . isBuffer ( data ) || typeof data === 'string' ) {
23+ if ( Buffer . isBuffer ( data ) || typeof data === 'string' || data instanceof Uint8Array ) {
2224 stream [ BODY ] . push ( Buffer . from ( data ) )
2325 } else {
2426 throw new Error ( `response.write() of unexpected type: ${ typeof data } ` )
You can’t perform that action at this time.
0 commit comments