tan-tan-kanarek / github-php-client

MIT License
184 stars 120 forks source link

Can't create issues #17

Closed nicoosh closed 10 years ago

nicoosh commented 10 years ago

Hi,

i'm using your library and i'm trying to create issue.

There is my code:

   $client = new GitHubClient();
   $client->setCredentials('username', 'password');
   $issue = new GithubIssues($client);
   $issue->createAnIssue('name', 'repo', 'title', 'content');

I'm getting a 500 error:

    Expected status [201], actual status [400], URL [/repos/nicolasheraly/API-Culture/issues]

Here is the stack trace:

at GitHubClientBase->parseResponse('/repos/nicolasheraly/API-Culture/issues', 'HTTP/1.1 100 ContinueHTTP/1.1 400 Bad RequestServer: GitHub.comDate: Wed, 07 May 2014 15:51:26 GMTContent-Type: application/json; charset=utf-8Status: 400 Bad RequestX-RateLimit-Limit: 5000X-RateLimit-Remaining: 4991X-RateLimit-Reset: 1399480094X-GitHub-Media-Type: github.v3X-XSS-Protection: 1; mode=blockX-Frame-Options: denyContent-Security-Policy: default-src 'none'Content-Length: 89Access-Control-Allow-Credentials: trueAccess-Control-Expose-Headers: ETag, Link, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-IntervalAccess-Control-Allow-Origin: *X-GitHub-Request-Id: BCA56D52:6B89:A1B1689:536A567EStrict-Transport-Security: max-age=31536000X-Content-Type-Options: nosniff{"message":"Problems parsing JSON","documentation_url":"https://developer.github.com/v3"}', 'GitHubIssue', 201, ) in SF_ROOT_DIR/lib/model/github-php-client/client/GitHubClientBase.php line 271 ...

I hope you can help me,

Nicolas Héraly

tan-tan-kanarek commented 10 years ago

Fixed. See pull-request: https://github.com/tan-tan-kanarek/github-php-client/pull/19

You also don't need to instantiate new GithubIssues, just use $issue = $client->issues->createAnIssue($owner, $repo, $title, $body).

nicoosh commented 10 years ago

Thanks