Skip to content

Commit acc62b2

Browse files
author
Joe Gallo
committed
fix for remove assignees from issue
The library was assuming that head|get|delete requests don't have a request body, which isn't the case for endpoints such as removeAssigneesFromIssue.
1 parent f3d3fd0 commit acc62b2

File tree

2 files changed

+23
-1
lines changed

2 files changed

+23
-1
lines changed

examples/removeAssigneesFromIssue.js

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
"use strict";
2+
3+
var Client = require("./../lib/index");
4+
var testAuth = require("./../testAuth.json");
5+
6+
var github = new Client({
7+
debug: true
8+
});
9+
10+
github.authenticate({
11+
type: "oauth",
12+
token: testAuth["token"]
13+
});
14+
15+
github.issues.removeAssigneesFromIssue({
16+
owner: "kaizensoze",
17+
repo: "test2",
18+
number: "4",
19+
body: { "assignees": ["first9890"] }
20+
}, function(err, res) {
21+
console.log(err, res);
22+
});

lib/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -612,7 +612,7 @@ var Client = module.exports = function(config) {
612612
var self = this;
613613
var method = block.method.toLowerCase();
614614
var hasFileBody = block.hasFileBody;
615-
var hasBody = !hasFileBody && ("head|get|delete".indexOf(method) === -1);
615+
var hasBody = !hasFileBody && typeof(msg.body) !== "undefined";
616616
var format = getRequestFormat.call(this, hasBody, block);
617617
var obj = getQueryAndUrl(msg, block, format, self.config);
618618
var query = obj.query;

0 commit comments

Comments
 (0)