Skip to content

Commit

Permalink
Merge remote-tracking branch 'fork/#229'
Browse files Browse the repository at this point in the history
  • Loading branch information
rultor committed May 1, 2015
2 parents ebb3dfb + 7e31b15 commit ec8992f
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions src/main/java/org/takes/facets/auth/social/PsGithub.java
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,9 @@
* @version $Id$
* @since 0.1
* @checkstyle MultipleStringLiteralsCheck (500 lines)
* @todo #229:30min There is currently no unit test in PsGithubTest that
* checks that the request parameters are passed to the request body,
* instead of the URI. Let's add this test.
*/
@EqualsAndHashCode(of = { "app", "key" })
public final class PsGithub implements Pass {
Expand Down Expand Up @@ -124,14 +127,16 @@ private String token(final String home, final String code)
throws IOException {
// @checkstyle LineLength (1 line)
final String uri = new Href("https://github.com/login/oauth/access_token")
.with("client_id", this.app)
.with("redirect_uri", home)
.with("client_secret", this.key)
.with("code", code)
.toString();
return new JdkRequest(uri)
.method("POST")
.header("Accept", "application/xml")
.body()
.formParam("client_id", this.app)
.formParam("redirect_uri", home)
.formParam("client_secret", this.key)
.formParam("code", code)
.back()
.fetch().as(RestResponse.class)
.assertStatus(HttpURLConnection.HTTP_OK)
.as(XmlResponse.class)
Expand Down

0 comments on commit ec8992f

Please sign in to comment.