api

Paddy 2015-12-05 Parent:6cf0c15d53e4 Child:9b954c219259

1:57c9412e8000 Browse Files

Switch order of arguments. Let's match Google; we'll put the context.Contexts as the first arguments in the Handlers.

api.go

     1.1 --- a/api.go	Sat Jul 18 03:39:27 2015 -0400
     1.2 +++ b/api.go	Sat Dec 05 01:59:43 2015 -0800
     1.3 @@ -42,7 +42,7 @@
     1.4  	Header string `json:"header,omitempty"`
     1.5  }
     1.6  
     1.7 -type ContextHandler func(http.ResponseWriter, *http.Request, context.Context)
     1.8 +type ContextHandler func(context.Context, http.ResponseWriter, *http.Request)
     1.9  
    1.10  func NegotiateMiddleware(h http.Handler) http.Handler {
    1.11  	return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
    1.12 @@ -106,7 +106,7 @@
    1.13  
    1.14  func ContextWrapper(c context.Context, handler ContextHandler) http.Handler {
    1.15  	return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
    1.16 -		handler(w, r, c)
    1.17 +		handler(c, w, r)
    1.18  	})
    1.19  }
    1.20