Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Delete assign #431

Closed
Oupsla opened this issue Oct 8, 2016 · 4 comments · Fixed by #432
Closed

Delete assign #431

Oupsla opened this issue Oct 8, 2016 · 4 comments · Fixed by #432

Comments

@Oupsla
Copy link

Oupsla commented Oct 8, 2016

Hello
I noticed an error about the "issues.removeAssigneesFromIssue".
I think that the api send the parameter as query and not in the body as json so Github return a 'Error parsing JSON'.

With node-github (not working) :

github.issues.removeAssigneesFromIssue({
        user: "user",
        repo: "repo",
        number: "1",
        assignees: "['userAssign']"
      }, function(err, res) {
          done(err, res);
      });

With require (working) :


var body = '{"assignees": ["'+userAssign+'"]}';

    var options = {
      url: "https://api.github.com/repos/user/repo/issues/1/assignees?access_token=" + token,
      method: "DEL",
      headers: {
        'User-Agent': 'MyApp-App'
      },
      json: JSON.parse(body)
    };

    request.del(options,function(error,response,body){
      if(error){
        console.log(error);
      }else{
        console.log(response);
      }
    });

Github link : https://developer.github.com/v3/issues/assignees/#remove-assignees-from-an-issue

kaizensoze pushed a commit that referenced this issue Oct 8, 2016
Change assignees from request param to body json input.

resolves #431
kaizensoze pushed a commit that referenced this issue Oct 8, 2016
Change assignees from request param to body json input.

resolves #431
@kaizensoze
Copy link

Should be fixed in v4.1.0.

@bkeepers
Copy link

Event with v4.1.0, I can't find an incantation that makes this work. I tried calling github.issues.removeAssigneesFromIssue with all of these variations:

{body:JSON.stringify({assignees:['bkeepers']})}
{body:JSON.stringify(['bkeepers'])}
{body:{assignees:['bkeepers']}}
{body:['bkeepers']}

All of those result in:

{"message":"Problems parsing JSON","documentation_url":"https://developer.github.com/v3"}

@kaizensoze
Copy link

Whoops, there's a bug in the codebase that assumes head|get|delete requests won't have a request body. Will have a fix out shortly.

@kaizensoze
Copy link

Ok should be fixed in 5.0.1. Added an example.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants