Skip to content

Commit 079aafa

Browse files
committed
Merge pull request #50 from code-check/async-1.9
Use async-1.19.21
2 parents 494a027 + bf59e16 commit 079aafa

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

build.sbt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ scalaVersion := "2.11.5"
88

99
// Change this to another test framework if you prefer
1010
libraryDependencies ++= Seq(
11-
"com.ning" % "async-http-client" % "1.8.15",
11+
"com.ning" % "async-http-client" % "1.9.21",
1212
"org.json4s" %% "json4s-jackson" % "3.2.11",
1313
"org.json4s" %% "json4s-ext" % "3.2.11",
1414
"joda-time" % "joda-time" % "2.7",

src/main/scala/codecheck/github/api/OAuthAPI.scala

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import com.ning.http.client.AsyncHttpClient
44
import com.ning.http.client.AsyncCompletionHandler
55
import com.ning.http.client.Response
66
import com.ning.http.client.RequestBuilder
7-
import com.ning.http.util.UTF8UrlEncoder
7+
import java.net.URLEncoder
88
import scala.concurrent.Promise
99
import scala.concurrent.Future
1010
import org.json4s.jackson.JsonMethods
@@ -27,7 +27,7 @@ class OAuthAPI(clientId: String, clientSecret: String, redirectUri: String, clie
2727
"response_type" -> "token",
2828
"state" -> UUID.randomUUID.toString
2929
)
30-
val query: String = params.map { case (k, v) => k +"="+ UTF8UrlEncoder.encode(v) }.mkString("&")
30+
val query: String = params.map { case (k, v) => k +"="+ URLEncoder.encode(v, "utf-8") }.mkString("&")
3131
accessRequestUri +"?"+ query
3232
}
3333

@@ -43,7 +43,7 @@ class OAuthAPI(clientId: String, clientSecret: String, redirectUri: String, clie
4343
.setHeader("Accept", "application/json")
4444
.setFollowRedirects(true)
4545
.setUrl(tokenRequestUri)
46-
params.foreach { case (k, v) => builder.addParameter(k, v) }
46+
params.foreach { case (k, v) => builder.addFormParam(k, v) }
4747

4848
val deferred = Promise[AccessToken]()
4949
client.prepareRequest(builder.build).execute(new AsyncCompletionHandler[Response]() {

0 commit comments

Comments
 (0)