Use resp.Code as the HTTP response code, unless the client has specifield they want 200-codes only.

This commit is contained in:
Howl 2016-04-04 16:47:15 +02:00
parent 851c90764a
commit b3b4dde8f2

View File

@ -55,9 +55,12 @@ func Method(f func(md common.MethodData) common.Response, db *sql.DB, privileges
resp := f(md)
if resp.Code == 0 {
c.IndentedJSON(500, resp)
} else {
resp.Code = 500
}
if _, exists := c.GetQuery("pls200"); exists {
c.IndentedJSON(200, resp)
} else {
c.IndentedJSON(resp.Code, resp)
}
}
}