|
|
@ -45,15 +45,15 @@ func AssetsHandlerFunc(opts *Options) http.HandlerFunc {
|
|
|
|
return
|
|
|
|
return
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
var corsSent bool
|
|
|
|
|
|
|
|
if opts.CorsHandler != nil {
|
|
|
|
if opts.CorsHandler != nil {
|
|
|
|
|
|
|
|
var corsSent bool
|
|
|
|
opts.CorsHandler(http.HandlerFunc(func(http.ResponseWriter, *http.Request) {
|
|
|
|
opts.CorsHandler(http.HandlerFunc(func(http.ResponseWriter, *http.Request) {
|
|
|
|
corsSent = true
|
|
|
|
corsSent = true
|
|
|
|
})).ServeHTTP(resp, req)
|
|
|
|
})).ServeHTTP(resp, req)
|
|
|
|
}
|
|
|
|
// If CORS is not sent, the response must have been written by other handlers
|
|
|
|
// If CORS is not sent, the response must have been written by other handlers
|
|
|
|
if !corsSent {
|
|
|
|
if !corsSent {
|
|
|
|
return
|
|
|
|
return
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
file := req.URL.Path[len(opts.Prefix):]
|
|
|
|
file := req.URL.Path[len(opts.Prefix):]
|
|
|
|