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 {
73
73
74
74
if ( serviceName === 'S3' && command . _isUploadRequest ) {
75
75
const upload = new Upload ( {
76
- client : client ,
76
+ client,
77
77
params : command . params ,
78
78
} ) ;
79
79
Original file line number Diff line number Diff line change @@ -100,16 +100,21 @@ class AwsInvoke {
100
100
return this . provider . request ( 'Lambda' , 'invoke' , params ) ;
101
101
}
102
102
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
+
103
115
log ( invocationReply ) {
104
116
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 ) ) ;
113
118
114
119
writeText ( JSON . stringify ( response , null , 4 ) ) ;
115
120
}
You can’t perform that action at this time.
0 commit comments