diff options
Diffstat (limited to 'backend')
-rw-r--r-- | backend/main.go | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/backend/main.go b/backend/main.go index 5ec4ce9..0bd5ebf 100644 --- a/backend/main.go +++ b/backend/main.go @@ -32,13 +32,13 @@ func MakeAPIResponse(status int, msg string, data interface{}) *APIResponse { func sendResponse(w http.ResponseWriter, code int, msg string, data interface{}) { w.Header().Set("Access-Control-Allow-Origin", "*") //Enable CORS + w.Header().Set("Content-Type", + "application/json; charset=UTF-8") + w.WriteHeader(code) resp := MakeAPIResponse(code, msg, data) - w.Header().Set("Content-Type", - "application/json; charset=UTF-8") - if err := json.NewEncoder(w).Encode(resp); err != nil { panic(err) } |