File tree Expand file tree Collapse file tree 2 files changed +14
-9
lines changed
Expand file tree Collapse file tree 2 files changed +14
-9
lines changed Original file line number Diff line number Diff line change @@ -73,7 +73,7 @@ class AWSClientFactory {
7373
7474 if ( serviceName === 'S3' && command . _isUploadRequest ) {
7575 const upload = new Upload ( {
76- client : client ,
76+ client,
7777 params : command . params ,
7878 } ) ;
7979
Original file line number Diff line number Diff line change @@ -100,16 +100,21 @@ class AwsInvoke {
100100 return this . provider . request ( 'Lambda' , 'invoke' , params ) ;
101101 }
102102
103+ payloadToString ( payload ) {
104+ if ( payload instanceof Uint8Array ) {
105+ return new TextDecoder ( ) . decode ( payload ) ;
106+ }
107+
108+ if ( Buffer . isBuffer ( payload ) ) {
109+ return payload . toString ( ) ;
110+ }
111+
112+ return payload ;
113+ }
114+
103115 log ( invocationReply ) {
104116 if ( invocationReply . Payload ) {
105- const payloadStr =
106- invocationReply . Payload instanceof Uint8Array
107- ? new TextDecoder ( ) . decode ( invocationReply . Payload )
108- : Buffer . isBuffer ( invocationReply . Payload )
109- ? invocationReply . Payload . toString ( )
110- : invocationReply . Payload ;
111-
112- const response = JSON . parse ( payloadStr ) ;
117+ const response = JSON . parse ( this . payloadToString ( invocationReply . Payload ) ) ;
113118
114119 writeText ( JSON . stringify ( response , null , 4 ) ) ;
115120 }
You can’t perform that action at this time.
0 commit comments