Closed nicolaasmatthijs closed 11 years ago
It's was done to prevent the request body from messing with global Object.prototype. Have a look at https://github.com/visionmedia/node-querystring/blob/master/test/parse.js#L154 Node is such a nightmare sometimes. haha
yeah I thought this may break some people's tests as well if they're using Object#should
with should.js, but overall it's a necessary change
where is the solution for this?
@jbarros35 and anyone else...
I got around this via a silly hack:
// body.hasOwnProperty doesn't exist
body = JSON.parse(JSON.stringify(body));
// body.hasOwnProperty now exists
nvm, having to replace all my code that uses hasOwnProperty
with something like this instead:
function has(obj, key){
return Object.prototype.hasOwnProperty.call(obj, key);
}
Thanks, Obama.
I'm using node-querystring as part of Express.js. After updating to the latest version of Express, the request body object passed into POST requests no longer has the
hasOwnProperty
function. I think I've been able to narrow this down to the changes made in #58 .Was this a deliberate change? If so, can you explain the rationale behind it? Thanks!