Allow CORS

- Set CORS headers to API requests
This commit is contained in:
sairajzero 2023-07-03 23:25:40 +05:30
parent e5c4c0dc65
commit d1a0c9326b

View File

@ -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)