diff --git a/handler.go b/handler.go index 8f6c14c..5935cf3 100644 --- a/handler.go +++ b/handler.go @@ -121,6 +121,13 @@ func NewHandler(config Config) (*Handler, error) { // Implement the http.Handler interface. func (handler *Handler) ServeHTTP(w http.ResponseWriter, r *http.Request) { + // Allow overriding the HTTP method. The reason for this is + // that some libraries/environments to not support PATCH and + // DELETE requests, e.g. Flash in a browser and parts of Java + if newMethod := r.Header.Get("Tus-Method-Override"); newMethod != "" { + r.Method = newMethod + } + go logger.Println(r.Method, r.URL.Path) header := w.Header()