Improve query string handling. 

* Add objectToQuery and queryToObject.
* Start replacing fragile URL query string manipulation with those functions.
* Fix specs that incorrectly depended on exact URL string equality, and other spec cleanup.

Fixes #2165
Maybe an a second example or (another parameter) that's an array in order to illustrate exactly how that behaves?  The description didn't make it immediately clear to me.