Skip to content

Commit

Permalink
Merge pull request #124 from btakita/gh-123
Browse files Browse the repository at this point in the history
Buffer.from '' if this.app._event.body is falsy
  • Loading branch information
jeremydaly committed Oct 29, 2019
2 parents 5cb096c + 9deffab commit e9944fe
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/request.js
Expand Up @@ -159,8 +159,8 @@ class REQUEST {
this.rawBody = this.app._event.body

// Set the body (decode it if base64 encoded)
this.body = this.app._event.isBase64Encoded ? Buffer.from(this.app._event.body, 'base64').toString() : this.app._event.body

this.body = this.app._event.isBase64Encoded ? Buffer.from(this.app._event.body||'', 'base64').toString() : this.app._event.body
// Set the body
if (this.headers['content-type'] && this.headers['content-type'].includes('application/x-www-form-urlencoded')) {
this.body = QS.parse(this.body)
Expand Down

0 comments on commit e9944fe

Please sign in to comment.