Open gabbottron opened 1 year ago
it's literally in the readme:
w.Header().Set("Content-Type", jsonapi.MediaType)
w.WriteHeader(http.StatusCreated)
if err := jsonapi.MarshalPayload(w, blog); err != nil {
http.Error(w, err.Error(), http.StatusInternalServerError)
}
I am using jsonapi with gin in a go project. In my create handlers I need to marshal the response and send it back, but the function sets the response code to 200 automagically and I want 201. Gin will not let me override the 200 response after this code block runs. Could you allow for a custom response code on this function if you insist on setting headers?
Thanks! -Geoff