Allow CORS
- Set CORS headers to API requests
This commit is contained in:
parent
e5c4c0dc65
commit
d1a0c9326b
@ -307,6 +307,7 @@ func (s *PublicServer) jsonHandler(handler func(r *http.Request, apiVersion int)
|
||||
data = jsonError{"Internal server error", http.StatusInternalServerError}
|
||||
}
|
||||
}
|
||||
w.Header().Set("Access-Control-Allow-Origin", "*")
|
||||
w.Header().Set("Content-Type", "application/json; charset=utf-8")
|
||||
if e, isError := data.(jsonError); isError {
|
||||
w.WriteHeader(e.HTTPStatus)
|
||||
|
||||
Loading…
Reference in New Issue
Block a user