This commit is contained in:
crusader 2018-03-07 21:04:28 +09:00
parent 46cfc967a9
commit 71b3163827

View File

@ -7,14 +7,14 @@ import (
) )
func SendRESTResponse(ctx *fasthttp.RequestCtx, response interface{}) { func SendRESTResponse(ctx *fasthttp.RequestCtx, response interface{}) {
ctx.SetContentType("application/javascript") ctx.SetContentType("application/json")
jRes, _ := json.Marshal(response) jRes, _ := json.Marshal(response)
ctx.SetBody(jRes) ctx.SetBody(jRes)
} }
func SendRESTError(ctx *fasthttp.RequestCtx, statusCode int, err error) { func SendRESTError(ctx *fasthttp.RequestCtx, statusCode int, err error) {
ctx.SetContentType("application/javascript") ctx.SetContentType("application/json")
ctx.SetStatusCode(statusCode) ctx.SetStatusCode(statusCode)
jRes, _ := json.Marshal(err) jRes, _ := json.Marshal(err)