Skip to content

Commit

Permalink
Merge pull request #6 from jusx/bugfix-request-querystring
Browse files Browse the repository at this point in the history
Fix get request to send params as querystring and the circleci build.
  • Loading branch information
jusx authored Oct 27, 2017
2 parents 64f5d5b + c216590 commit bc1a4c2
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 12 deletions.
6 changes: 3 additions & 3 deletions circle.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
test:
override:
- mocha
machine:
node:
version: 4.5.0
6 changes: 5 additions & 1 deletion lib/wufoo.js
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,11 @@ Wufoo.prototype.request = function(method, uri, params, fn) {
}
}

if (fn!=undefined && params !=undefined) options["body"] = require('querystring').stringify(params); // params for form post was passed in.
if (fn!=undefined && params !=undefined) {
var stringified = require("querystring").stringify(params);
if (options["method"]=="GET") options["uri"] = options["uri"] + "?" + stringified;
else options["body"] = stringified; // params for form post was passed in.
}
if (fn == undefined && params != undefined) fn = params; // no params was passed in. In which case it is fn callback.

request(options, function(err, res, body) {
Expand Down
33 changes: 25 additions & 8 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,13 @@
"name": "wufoo",
"description": "Wrapper for the Wufoo API (http://www.wufoo.com/docs/api/v3/)",
"version": "1.1.0",
"author": {"name": "Justin Law", "email": "<hello@justinlaw.org>"},
"contributors": ["Ahmader <hello@ahmader.sa>"],
"author": {
"name": "Justin Law",
"email": "<hello@justinlaw.org>"
},
"contributors": [
"Ahmader <hello@ahmader.sa>"
],
"dependencies": {
"request": "^2.83.0"
},
Expand All @@ -13,11 +18,23 @@
"url": "https://github.com/jusx/node-wufoo.git"
},
"homepage": "https://github.com/jusx/node-wufoo",
"keywords": ["wufoo", "wufoo api", "api"],
"devDependencies": { "mocha": "*", "should":"*" },
"keywords": [
"wufoo",
"wufoo api",
"api"
],
"devDependencies": {
"mocha": "*",
"should": "*"
},
"license": "MIT",
"bugs": {
"url": "https://github.com/jusx/node-wufoo/issues"
},
"engines": ["node >= 0.8.0"]
}
"url": "https://github.com/jusx/node-wufoo/issues"
},
"scripts": {
"test": "mocha"
},
"engines": [
"node >= 0.8.0"
]
}

0 comments on commit bc1a4c2

Please sign in to comment.