Add Tus-Method-Override header
This commit is contained in:
parent
75506bc129
commit
a284e89e28
|
@ -121,6 +121,13 @@ func NewHandler(config Config) (*Handler, error) {
|
||||||
|
|
||||||
// Implement the http.Handler interface.
|
// Implement the http.Handler interface.
|
||||||
func (handler *Handler) ServeHTTP(w http.ResponseWriter, r *http.Request) {
|
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)
|
go logger.Println(r.Method, r.URL.Path)
|
||||||
|
|
||||||
header := w.Header()
|
header := w.Header()
|
||||||
|
|
Loading…
Reference in New Issue