Skip to content

Commit

Permalink
Fix borken concatenation of very large responses
Browse files Browse the repository at this point in the history
  • Loading branch information
ryanblock committed Sep 26, 2023
1 parent 7550a01 commit 0b66798
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/request.js
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,8 @@ module.exports = function request (params, creds, region, config, metadata) {
let ok = statusCode >= 200 && statusCode < 303
res.on('data', chunk => data.push(chunk))
res.on('end', () => {
let result = data.join()
// TODO The following string coersion will definitely need be changed when we get into binary response payloads
let result = Buffer.concat(data).toString()
let contentType = headers['content-type'] || headers['Content-Type'] || ''
if (JSONContentType(contentType) || AwsJSONContentType(contentType)) {
result = JSON.parse(result)
Expand Down

0 comments on commit 0b66798

Please sign in to comment.