bump(github.com/gorilla/mux): 9ede152210fa25c1377d33e867cb828c19316445
This commit is contained in:
2
third_party/github.com/gorilla/mux/mux.go
vendored
2
third_party/github.com/gorilla/mux/mux.go
vendored
@ -166,7 +166,7 @@ func (r *Router) Handle(path string, handler http.Handler) *Route {
|
|||||||
// HandleFunc registers a new route with a matcher for the URL path.
|
// HandleFunc registers a new route with a matcher for the URL path.
|
||||||
// See Route.Path() and Route.HandlerFunc().
|
// See Route.Path() and Route.HandlerFunc().
|
||||||
func (r *Router) HandleFunc(path string, f func(http.ResponseWriter,
|
func (r *Router) HandleFunc(path string, f func(http.ResponseWriter,
|
||||||
*http.Request)) *Route {
|
*http.Request),) *Route {
|
||||||
return r.NewRoute().Path(path).HandlerFunc(f)
|
return r.NewRoute().Path(path).HandlerFunc(f)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
12
third_party/github.com/gorilla/mux/mux_test.go
vendored
12
third_party/github.com/gorilla/mux/mux_test.go
vendored
@ -22,7 +22,6 @@ type routeTest struct {
|
|||||||
shouldMatch bool // whether the request is expected to match the route at all
|
shouldMatch bool // whether the request is expected to match the route at all
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
func TestHost(t *testing.T) {
|
func TestHost(t *testing.T) {
|
||||||
// newRequestHost a new request with a method, url, and host header
|
// newRequestHost a new request with a method, url, and host header
|
||||||
newRequestHost := func(method, url, host string) *http.Request {
|
newRequestHost := func(method, url, host string) *http.Request {
|
||||||
@ -673,7 +672,7 @@ func testRoute(t *testing.T, test routeTest) {
|
|||||||
func TestKeepContext(t *testing.T) {
|
func TestKeepContext(t *testing.T) {
|
||||||
func1 := func(w http.ResponseWriter, r *http.Request) {}
|
func1 := func(w http.ResponseWriter, r *http.Request) {}
|
||||||
|
|
||||||
r:= NewRouter()
|
r := NewRouter()
|
||||||
r.HandleFunc("/", func1).Name("func1")
|
r.HandleFunc("/", func1).Name("func1")
|
||||||
|
|
||||||
req, _ := http.NewRequest("GET", "http://localhost/", nil)
|
req, _ := http.NewRequest("GET", "http://localhost/", nil)
|
||||||
@ -698,7 +697,6 @@ func TestKeepContext(t *testing.T) {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
type TestA301ResponseWriter struct {
|
type TestA301ResponseWriter struct {
|
||||||
hh http.Header
|
hh http.Header
|
||||||
status int
|
status int
|
||||||
@ -708,11 +706,11 @@ func (ho TestA301ResponseWriter) Header() http.Header {
|
|||||||
return http.Header(ho.hh)
|
return http.Header(ho.hh)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (ho TestA301ResponseWriter) Write( b []byte) (int, error) {
|
func (ho TestA301ResponseWriter) Write(b []byte) (int, error) {
|
||||||
return 0, nil
|
return 0, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (ho TestA301ResponseWriter) WriteHeader( code int ) {
|
func (ho TestA301ResponseWriter) WriteHeader(code int) {
|
||||||
ho.status = code
|
ho.status = code
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -722,7 +720,7 @@ func Test301Redirect(t *testing.T) {
|
|||||||
func1 := func(w http.ResponseWriter, r *http.Request) {}
|
func1 := func(w http.ResponseWriter, r *http.Request) {}
|
||||||
func2 := func(w http.ResponseWriter, r *http.Request) {}
|
func2 := func(w http.ResponseWriter, r *http.Request) {}
|
||||||
|
|
||||||
r:= NewRouter()
|
r := NewRouter()
|
||||||
r.HandleFunc("/api/", func2).Name("func2")
|
r.HandleFunc("/api/", func2).Name("func2")
|
||||||
r.HandleFunc("/", func1).Name("func1")
|
r.HandleFunc("/", func1).Name("func1")
|
||||||
|
|
||||||
@ -730,7 +728,7 @@ func Test301Redirect(t *testing.T) {
|
|||||||
|
|
||||||
res := TestA301ResponseWriter{
|
res := TestA301ResponseWriter{
|
||||||
hh: m,
|
hh: m,
|
||||||
status : 0,
|
status: 0,
|
||||||
}
|
}
|
||||||
r.ServeHTTP(&res, req)
|
r.ServeHTTP(&res, req)
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user