diff options
author | Tucker Evans <tuckerevans24@gmail.com> | 2019-12-02 16:43:43 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-12-02 16:43:43 -0500 |
commit | e3340c8df1892356ecf58116db9e910662554eed (patch) | |
tree | 3240e099653b60e08b762f814efdc65ea27c9b3b /backend/main.go | |
parent | ba3fc1b1ec14035009cbfc642e04fbf1034ce735 (diff) | |
parent | d854dedd5297aaa7901fc2b2b304c8b160830836 (diff) |
Merge branch 'master' into api_json=recipe_object
Diffstat (limited to 'backend/main.go')
-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) } |