REST API: remove status from ApiResponse

it duplicates the header HTTP status
This commit is contained in:
Nicola Murino
2020-09-08 09:45:21 +02:00
parent b9c381e26f
commit 01850c7399
5 changed files with 180 additions and 875 deletions

View File

@@ -67,9 +67,8 @@ func sendAPIResponse(w http.ResponseWriter, r *http.Request, err error, message
errorString = err.Error()
}
resp := apiResponse{
Error: errorString,
Message: message,
HTTPStatus: code,
Error: errorString,
Message: message,
}
ctx := context.WithValue(r.Context(), render.StatusCtxKey, code)
render.JSON(w, r.WithContext(ctx), resp)