Allow CORS request
This commit is contained in:
parent
eec4b1b19e
commit
f17dac8542
2
main.go
2
main.go
@ -196,6 +196,8 @@ func ServeJSONStudent(w http.ResponseWriter, r *http.Request) {
|
|||||||
log.Printf("Handling %s request from %s: %s [%s]\n", r.Method, r.RemoteAddr, r.URL.Path, r.UserAgent())
|
log.Printf("Handling %s request from %s: %s [%s]\n", r.Method, r.RemoteAddr, r.URL.Path, r.UserAgent())
|
||||||
|
|
||||||
w.Header().Set("Content-Type", "application/json")
|
w.Header().Set("Content-Type", "application/json")
|
||||||
|
w.Header().Set("Access-Control-Allow-Origin", "*")
|
||||||
|
w.Header().Set("Access-Control-Allow-Methods", "GET, OPTIONS")
|
||||||
|
|
||||||
login := strings.TrimSuffix(strings.TrimPrefix(r.URL.Path, "/"), ".json")
|
login := strings.TrimSuffix(strings.TrimPrefix(r.URL.Path, "/"), ".json")
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user