Skip to content
This repository was archived by the owner on May 15, 2019. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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
Expand Down
3 changes: 3 additions & 0 deletions CONTRIBUTORS
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,11 @@
# Names are formatted as:
# name <email>
#
Ace Nassri <anassri@google.com>
Akinori Machino <akinori.machino@icloud.com>
Jason Dobry <jason.dobry@gmail.com>
Jason Polites <jason.polites@gmail.com>
Justin Beckwith <justin.beckwith@gmail.com>
Kim Vogt <kim.vogt@gmail.com>
Kris J. Pruden <kpruden@users.noreply.github.com>
Lauren Long <laurenzlong@users.noreply.github.com>
Expand All @@ -15,3 +17,4 @@ Slawek Walkowski <swalkowski@users.noreply.github.com>
Tim Swast <swast@google.com>
Tina Liang <tinaliang@google.com>
aminy <aminy@indicee.com>
renovate[bot] <renovate[bot]@users.noreply.github.com>
7 changes: 5 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -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": {
Expand Down Expand Up @@ -40,9 +40,11 @@
]
},
"contributors": [
"Ace Nassri <anassri@google.com>",
"Akinori Machino <akinori.machino@icloud.com>",
"Jason Dobry <jason.dobry@gmail.com>",
"Jason Polites <jason.polites@gmail.com>",
"Justin Beckwith <justin.beckwith@gmail.com>",
"Kim Vogt <kim.vogt@gmail.com>",
"Kris J. Pruden <kpruden@users.noreply.github.com>",
"Lauren Long <laurenzlong@users.noreply.github.com>",
Expand All @@ -51,7 +53,8 @@
"Slawek Walkowski <swalkowski@users.noreply.github.com>",
"Tim Swast <swast@google.com>",
"Tina Liang <tinaliang@google.com>",
"aminy <aminy@indicee.com>"
"aminy <aminy@indicee.com>",
"renovate[bot] <renovate[bot]@users.noreply.github.com>"
],
"scripts": {
"lint": "semistandard",
Expand Down
17 changes: 13 additions & 4 deletions src/supervisor/worker.js
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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');
Expand Down