From c592053f8b299fa0c51997022088161b6f13aa3b Mon Sep 17 00:00:00 2001 From: Jason Dobry Date: Wed, 1 Aug 2018 13:02:28 -0700 Subject: [PATCH] 1.0.0-beta.5 (#263) --- CHANGELOG.md | 9 +++++++++ CONTRIBUTORS | 3 +++ package.json | 7 +++++-- src/supervisor/worker.js | 17 +++++++++++++---- 4 files changed, 30 insertions(+), 6 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index a06b7a9..2b4dfe9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,12 @@ +##### 1.0.0-beta.5 - 31 July 2018 + +###### Bug fixes +- [#161](https://github.com/GoogleCloudPlatform/cloud-functions-emulator/issues/161) - The emulator behaves differently than the production version with respect to the rawBody property +- [#261](https://github.com/GoogleCloudPlatform/cloud-functions-emulator/pull/261) - Update Node.js version warning message + +###### Other +- Updated dependencies + ##### 1.0.0-beta.4 - 06 March 2018 ###### Bug fixes diff --git a/CONTRIBUTORS b/CONTRIBUTORS index 43a1be5..52b3db1 100644 --- a/CONTRIBUTORS +++ b/CONTRIBUTORS @@ -3,9 +3,11 @@ # Names are formatted as: # name # +Ace Nassri Akinori Machino Jason Dobry Jason Polites +Justin Beckwith Kim Vogt Kris J. Pruden Lauren Long @@ -15,3 +17,4 @@ Slawek Walkowski Tim Swast Tina Liang aminy +renovate[bot] diff --git a/package.json b/package.json index 97fcb52..177ca89 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "@google-cloud/functions-emulator", "description": "Google Cloud Functions Emulator", - "version": "1.0.0-beta.4", + "version": "1.0.0-beta.5", "license": "Apache-2.0", "author": "Google Inc.", "engines": { @@ -40,9 +40,11 @@ ] }, "contributors": [ + "Ace Nassri ", "Akinori Machino ", "Jason Dobry ", "Jason Polites ", + "Justin Beckwith ", "Kim Vogt ", "Kris J. Pruden ", "Lauren Long ", @@ -51,7 +53,8 @@ "Slawek Walkowski ", "Tim Swast ", "Tina Liang ", - "aminy " + "aminy ", + "renovate[bot] " ], "scripts": { "lint": "semistandard", diff --git a/src/supervisor/worker.js b/src/supervisor/worker.js index 0893172..e0c7f6b 100644 --- a/src/supervisor/worker.js +++ b/src/supervisor/worker.js @@ -88,11 +88,17 @@ function main () { req.rawBody = buf; }; - const rawBodySavingOptions = { + const defaultBodySavingOptions = { limit: requestLimit, verify: rawBodySaver }; + const rawBodySavingOptions = { + limit: requestLimit, + verify: rawBodySaver, + type: '*/*' + }; + // Use extended query string parsing for URL-encoded bodies. const urlEncodedOptions = { limit: requestLimit, @@ -101,11 +107,14 @@ function main () { }; // Parse request body - app.use(bodyParser.raw(rawBodySavingOptions)); - app.use(bodyParser.json(rawBodySavingOptions)); - app.use(bodyParser.text(rawBodySavingOptions)); + app.use(bodyParser.json(defaultBodySavingOptions)); + app.use(bodyParser.text(defaultBodySavingOptions)); app.use(bodyParser.urlencoded(urlEncodedOptions)); + // MUST be last in the list of body parsers as subsequent parsers will be + // skipped when one is matched. + app.use(bodyParser.raw(rawBodySavingOptions)); + // Never cache app.use((req, res, next) => { res.set('Cache-Control', 'no-cache, no-store, must-revalidate');