We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
blocking
1 parent 04e9970 commit 1d89563Copy full SHA for 1d89563
1 file changed
scalajvm/app/helpers/ReCaptcha.scala
@@ -18,6 +18,7 @@ class ReCaptcha @Inject()(implicit configuration: Configuration) {
18
19
def check(addr: String, response: String): Future[Boolean] = {
20
val request = Http(verificationUrl).params("secret" -> privateKey, "response" -> response, "remoteip" -> addr)
21
+ // scalaj-http is a synchronous library, so calling `asString` will block the executor's thread - which is why we annotate the call with `blocking`
22
val result = Future { blocking { request.asString.body } }
23
result.map { res => Json.parse(res).get("success").asBoolean() } // TODO: Proper error handling, check recaptcha documentation
24
}
0 commit comments