Skip to content

Commit

Permalink
remove jsonp support
Browse files Browse the repository at this point in the history
  • Loading branch information
niklasf committed May 7, 2018
1 parent e7ac389 commit 1a9cb51
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 6 deletions.
2 changes: 1 addition & 1 deletion README.md
Expand Up @@ -59,7 +59,7 @@ Index from command line
HTTP API
--------

CORS enabled for all domains. Provide `callback` parameter to use JSONP.
CORS enabled for all domains.

### `GET /master` query opening database with master games

Expand Down
6 changes: 1 addition & 5 deletions app/controllers/WebApi.scala
Expand Up @@ -144,11 +144,7 @@ class WebApi @Inject() (
if (Config.explorer.corsHeader) res.withHeaders("Access-Control-Allow-Origin" -> "*")
else res

def JsonResult(json: String)(implicit req: RequestHeader) =
req.queryString.get("callback").flatMap(_.headOption) match {
case Some(callback) => Ok(s"$callback($json)").as("application/javascript; charset=utf-8")
case None => Ok(json).as("application/json; charset=utf-8")
}
def JsonResult(json: String) = Ok(json).as("application/json; charset=utf-8")

private def fenMoveNumber(fen: String) = fen split ' ' lift 5 flatMap parseIntOption
}

0 comments on commit 1a9cb51

Please sign in to comment.