Added Access-Control-Allow-Headers to allow cors requests with those headers

This commit is contained in:
Chris Ridde 2014-07-10 17:02:41 +01:00
parent 1cffdb3a48
commit d9df58beb8

View File

@ -54,6 +54,7 @@ type CORSHandler struct {
func (h *CORSHandler) addHeader(w http.ResponseWriter, origin string) {
w.Header().Add("Access-Control-Allow-Methods", "POST, GET, OPTIONS, PUT, DELETE")
w.Header().Add("Access-Control-Allow-Origin", origin)
w.Header().Add("Access-Control-Allow-Headers", "accept, content-type")
}
// ServeHTTP adds the correct CORS headers based on the origin and returns immediately