Skip to content

Commit

Permalink
Merge pull request #74 from rakyll/master
Browse files Browse the repository at this point in the history
Path params should be considered as query params
  • Loading branch information
Burcu Dogan committed Aug 5, 2013
2 parents 032fa15 + d01537c commit 95b32a9
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 2 deletions.
3 changes: 2 additions & 1 deletion lib/requests.js
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,8 @@ BaseRequest.prototype.containsQueryParams = function(params) {
}
var parameters = this.methodMeta.parameters || {};
for (var paramName in parameters) {
if (parameters[paramName].location == 'query' &&
if ((parameters[paramName].location == 'query' ||
parameters[paramName].location == 'path') &&
params[paramName]) {
return true;
}
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "googleapis",
"version": "0.4.1",
"version": "0.4.2",
"author": "Google Inc.",
"description": "Google APIs Client Library for Node.js",
"contributors": [
Expand Down
2 changes: 2 additions & 0 deletions tests/test.requests.js
Original file line number Diff line number Diff line change
Expand Up @@ -212,10 +212,12 @@ describe('Requests', function() {
googleapis.discover('drive', 'v2').execute(function(err, client) {
var req1 = client.drive.files.insert({ title: 'Hello' });
var req2 = client.drive.files.list({ q: 'title contains "H"' });
var req3 = client.drive.files.get({ fileId: 'root' });

assert.equal(req1.params.title, null);
assert.equal(req1.body.title, 'Hello');
assert.equal(req2.params.q, 'title contains "H"');
assert.equal(req3.generatePath(req3.params), '/drive/v2/files/root');
done();
});
});
Expand Down

0 comments on commit 95b32a9

Please sign in to comment.