Skip to content

Commit

Permalink
v1.0.1 nilify blanks for request parameters
Browse files Browse the repository at this point in the history
  • Loading branch information
izelnakri committed Jan 9, 2018
1 parent 3871e2e commit 52b78b8
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 1 deletion.
4 changes: 4 additions & 0 deletions lib/mem-server-cjs.js
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,10 @@ function castCorrectType(value) {
return true;
} else if (value === '') {
return null;
} else if (typeof value === 'object') {
return Object.keys(value).reduce((object, key) => {
return Object.assign(object, { [key]: value[key] === '' ? null : value[key] });
}, {});
}

return value;
Expand Down
4 changes: 4 additions & 0 deletions lib/pretender-hacks.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,10 @@ function castCorrectType(value) {
return true;
} else if (value === '') {
return null;
} else if (typeof value === 'object') {
return Object.keys(value).reduce((object, key) => {
return Object.assign(object, { [key]: value[key] === '' ? null : value[key] });
}, {});
}

return value;
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "memserver",
"version": "1.0.0",
"version": "1.0.1",
"description": "in-memory database/ORM and http mock server you can run in-browser and node environments. Built for large frontend teams, fast tests and rapid prototyping",
"main": "lib/index.js",
"license": "ISC",
Expand Down

0 comments on commit 52b78b8

Please sign in to comment.