Use qs stringify for post body #46

wants to merge 3 commits into


None yet

2 participants

bantic commented Jun 29, 2011

This uses qs.stringify to turn options.body into a string if it is an object in I am not sure the best way to determine if a variable is an object so I used (which I saw used in node-querystring (

@tj tj commented on the diff Jun 29, 2011
@@ -157,6 +158,9 @@ Browser.prototype.request = function(method, path, options, fn, saveHistory){
// Request body
if (options.body) {
+ if ('[object Object]' === {
+ options.body = qs.stringify(options.body);
tj Jun 29, 2011 LearnBoost member

would be nice to abstract these out a little with an object mapping content types to functions say something like:

exports.stringify['application/x-www-form-urlencoded'] = qs.stringify

so then we could have application/json etc

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment