Rename TusMiddleware function to Middleware
This commit is contained in:
parent
12037a8e1d
commit
218cdfd022
|
@ -33,7 +33,7 @@ func NewHandler(config Config) (*Handler, error) {
|
||||||
|
|
||||||
mux := pat.New()
|
mux := pat.New()
|
||||||
|
|
||||||
routedHandler.routeHandler = handler.TusMiddleware(mux)
|
routedHandler.routeHandler = handler.Middleware(mux)
|
||||||
|
|
||||||
mux.Post("", http.HandlerFunc(handler.PostFile))
|
mux.Post("", http.HandlerFunc(handler.PostFile))
|
||||||
mux.Head(":id", http.HandlerFunc(handler.HeadFile))
|
mux.Head(":id", http.HandlerFunc(handler.HeadFile))
|
||||||
|
|
|
@ -122,12 +122,12 @@ func NewUnroutedHandler(config Config) (*UnroutedHandler, error) {
|
||||||
return handler, nil
|
return handler, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// TusMiddleware checks various aspects of the request and ensures that it
|
// Middleware checks various aspects of the request and ensures that it
|
||||||
// conforms with the spec. Also handles method overriding for clients which
|
// conforms with the spec. Also handles method overriding for clients which
|
||||||
// cannot make PATCH AND DELETE requests. If you are using the tusd handlers
|
// cannot make PATCH AND DELETE requests. If you are using the tusd handlers
|
||||||
// directly you will need to wrap at least the POST and PATCH endpoints in
|
// directly you will need to wrap at least the POST and PATCH endpoints in
|
||||||
// this middleware.
|
// this middleware.
|
||||||
func (handler *UnroutedHandler) TusMiddleware(h http.Handler) http.Handler {
|
func (handler *UnroutedHandler) Middleware(h http.Handler) http.Handler {
|
||||||
return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
|
return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
|
||||||
// Allow overriding the HTTP method. The reason for this is
|
// Allow overriding the HTTP method. The reason for this is
|
||||||
// that some libraries/environments to not support PATCH and
|
// that some libraries/environments to not support PATCH and
|
||||||
|
|
Loading…
Reference in New Issue