Merge pull request #55 from rr83019/master

Remove POST support for media endpoint
This commit is contained in:
hrj 2021-02-18 20:00:45 +05:30 committed by GitHub
commit b66f777828
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -26,21 +26,13 @@ class Server(port: Int, captcha: Captcha, dbConn: DBConn){
},"POST")
host.addContext("/v1/media",(req, resp) => {
val id = if ("GET" == req.getMethod()){
val params = req.getParams()
val gid = Id(params.get("id"))
gid
} else {
val body = req.getJson()
val json = parse(body)
val gid = json.extract[Id]
gid
}
val params = req.getParams()
val id = Id(params.get("id"))
val image = captcha.getCaptcha(id)
resp.getHeaders().add("Content-Type","image/png")
resp.send(200, image)
0
},"POST", "GET")
},"GET")
host.addContext("/v1/answer",(req, resp) => {
val body = req.getJson()