Skip to content

Commit

Permalink
respect payloadAsStream also in error case
Browse files Browse the repository at this point in the history
  • Loading branch information
adrai committed Jan 26, 2025
1 parent 275d0ff commit b4ffa0d
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -115,10 +115,19 @@ module.exports = (app, options) => {
currentAwsArguments = {}
if (err) {
console.error(err)
if (!options.payloadAsStream) {
return resolve({
statusCode: 500,
body: '',
headers: {}
})
}
return resolve({
statusCode: 500,
body: '',
headers: {}
meta: {
statusCode: 500,
headers: {}
},
stream: (res && res.stream()) || require('node:stream').Readable.from('')
})
}
// chunked transfer not currently supported by API Gateway
Expand Down

0 comments on commit b4ffa0d

Please sign in to comment.