This commit is contained in:
mappu 2017-10-08 17:06:24 +13:00
parent 75c3a98f33
commit 5b1a94c735
1 changed files with 2 additions and 2 deletions

View File

@ -86,6 +86,7 @@ const (
func (this *Server) ServeHTTP(w http.ResponseWriter, r *http.Request) {
w.Header().Set(`Server`, SERVER_HEADER)
w.Header().Set(`Access-Control-Allow-Origin`, `*`) // Blanket allow CORS
if this.opts.MaxUploadBytes > 0 {
r.Body = http.MaxBytesReader(w, r.Body, this.opts.MaxUploadBytes)
}
@ -108,8 +109,7 @@ func (this *Server) ServeHTTP(w http.ResponseWriter, r *http.Request) {
this.handleUpload(w, r)
} else if r.Method == "OPTIONS" {
// Blanket allow
w.Header().Set(`Access-Control-Allow-Origin`, `*`)
// Blanket allow (headers already set)
w.WriteHeader(200)
} else if r.Method == "GET" && r.URL.Path == `/` {