rudimentary CORS support
This commit is contained in:
parent
d695bc1255
commit
8795db5150
@ -107,7 +107,12 @@ func (this *Server) ServeHTTP(w http.ResponseWriter, r *http.Request) {
|
|||||||
} else if r.Method == "POST" && r.URL.Path == `/upload` {
|
} else if r.Method == "POST" && r.URL.Path == `/upload` {
|
||||||
this.handleUpload(w, r)
|
this.handleUpload(w, r)
|
||||||
|
|
||||||
} else if static, err := Asset(r.URL.Path[1:]); err == nil {
|
} else if r.Method == "OPTIONS" {
|
||||||
|
// Blanket allow
|
||||||
|
w.Header().Set(`Access-Control-Allow-Origin`, `*`)
|
||||||
|
w.WriteHeader(200)
|
||||||
|
|
||||||
|
} else if r.Method == "GET" && static, err := Asset(r.URL.Path[1:]); err == nil {
|
||||||
http.ServeContent(w, r, r.URL.Path[1:], this.startTime, bytes.NewReader(static))
|
http.ServeContent(w, r, r.URL.Path[1:], this.startTime, bytes.NewReader(static))
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
Loading…
Reference in New Issue
Block a user