Remove POST support for media endpoint

Signed-off-by: Rahul Rudragoudar <rr83019@gmail.com>
This commit is contained in:
Rahul Rudragoudar 2021-02-18 15:24:47 +05:30
parent b16c2698d2
commit c10a66a23b
No known key found for this signature in database
GPG Key ID: 0D2CE231A7287EBC

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()