tj / node-querystring

querystring parser for node and the browser - supporting nesting (used by Express, Connect, etc)
MIT License
455 stars 66 forks source link

Stringify filtering out null values #52

Closed jwarkentin closed 11 years ago

jwarkentin commented 11 years ago

A recent change seems to be filtering out null values from objects when encoding them. I use the request module for Node.js which depends on node-querystring and this change broke my application.

Calling stringify() on an object such as {var1: null, var2: null} returns an empty string when it should not.

The way the official Node.js 'querystring' module encodes it, and the way node-querystring has up until now is '?var1=&var2='. There has been a long discussion over at jQuery trying to determine how to encode null variables with $.param() and they also settled on '?var1=&var2='. For a long time jQuery has encoded it by setting '?var1=null&var2=null', but that behavior has changed in more recent versions. Either way, they do not throw away the variable.

See jQuery discussion: http://bugs.jquery.com/ticket/8653

tj commented 11 years ago

I'm impartial, I'll alter it to do key=

jwarkentin commented 11 years ago

Awesome, thanks!