From 218cdfd02200806bb9144814143d2d6ff0a75f27 Mon Sep 17 00:00:00 2001 From: Max Brosnahan Date: Tue, 8 Dec 2015 09:10:02 +1300 Subject: [PATCH] Rename TusMiddleware function to Middleware --- handler.go | 2 +- unrouted_handler.go | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/handler.go b/handler.go index 916dc3f..a6a6136 100644 --- a/handler.go +++ b/handler.go @@ -33,7 +33,7 @@ func NewHandler(config Config) (*Handler, error) { mux := pat.New() - routedHandler.routeHandler = handler.TusMiddleware(mux) + routedHandler.routeHandler = handler.Middleware(mux) mux.Post("", http.HandlerFunc(handler.PostFile)) mux.Head(":id", http.HandlerFunc(handler.HeadFile)) diff --git a/unrouted_handler.go b/unrouted_handler.go index d451b22..81d7d0b 100644 --- a/unrouted_handler.go +++ b/unrouted_handler.go @@ -122,12 +122,12 @@ func NewUnroutedHandler(config Config) (*UnroutedHandler, error) { 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 // 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 // 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) { // Allow overriding the HTTP method. The reason for this is // that some libraries/environments to not support PATCH and