Use resp.Code as the HTTP response code, unless the client has specifield they want 200-codes only.
This commit is contained in:
parent
851c90764a
commit
b3b4dde8f2
|
@ -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)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user