Allow CORS request

This commit is contained in:
nemunaire 2022-08-15 09:41:44 +02:00
parent eec4b1b19e
commit f17dac8542
1 changed files with 2 additions and 0 deletions

View File

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