Drop patches
Shengjing Zhu
3 years ago
0 | Description: Fix test failure with Go 1.10 | |
1 | Author: Rebecca Stambler <rstambler@golang.org> | |
2 | Origin: vendor, https://github.com/julienschmidt/httprouter/commit/0b0afca848ce5cf472a0dbb426b54e5cdb630f16 | |
3 | Last-Update: 2018-02-16 | |
4 | ||
5 | --- | |
6 | ||
7 | From 0b0afca848ce5cf472a0dbb426b54e5cdb630f16 Mon Sep 17 00:00:00 2001 | |
8 | From: Rebecca Stambler <rstambler@golang.org> | |
9 | Date: Fri, 27 Oct 2017 09:33:06 -0400 | |
10 | Subject: [PATCH] router_test.go: fix to handle changes to Content-Type header | |
11 | (#220) | |
12 | ||
13 | --- | |
14 | router_test.go | 28 ++++++++++++++-------------- | |
15 | 1 file changed, 14 insertions(+), 14 deletions(-) | |
16 | ||
17 | diff --git a/router_test.go b/router_test.go | |
18 | index fe58c8a..b774a4e 100644 | |
19 | --- a/router_test.go | |
20 | +++ b/router_test.go | |
21 | @@ -364,26 +364,26 @@ func TestRouterNotFound(t *testing.T) { | |
22 | router.GET("/", handlerFunc) | |
23 | ||
24 | testRoutes := []struct { | |
25 | - route string | |
26 | - code int | |
27 | - header string | |
28 | + route string | |
29 | + code int | |
30 | + location string | |
31 | }{ | |
32 | - {"/path/", 301, "map[Location:[/path]]"}, // TSR -/ | |
33 | - {"/dir", 301, "map[Location:[/dir/]]"}, // TSR +/ | |
34 | - {"", 301, "map[Location:[/]]"}, // TSR +/ | |
35 | - {"/PATH", 301, "map[Location:[/path]]"}, // Fixed Case | |
36 | - {"/DIR/", 301, "map[Location:[/dir/]]"}, // Fixed Case | |
37 | - {"/PATH/", 301, "map[Location:[/path]]"}, // Fixed Case -/ | |
38 | - {"/DIR", 301, "map[Location:[/dir/]]"}, // Fixed Case +/ | |
39 | - {"/../path", 301, "map[Location:[/path]]"}, // CleanPath | |
40 | - {"/nope", 404, ""}, // NotFound | |
41 | + {"/path/", 301, "/path"}, // TSR -/ | |
42 | + {"/dir", 301, "/dir/"}, // TSR +/ | |
43 | + {"", 301, "/"}, // TSR +/ | |
44 | + {"/PATH", 301, "/path"}, // Fixed Case | |
45 | + {"/DIR/", 301, "/dir/"}, // Fixed Case | |
46 | + {"/PATH/", 301, "/path"}, // Fixed Case -/ | |
47 | + {"/DIR", 301, "/dir/"}, // Fixed Case +/ | |
48 | + {"/../path", 301, "/path"}, // CleanPath | |
49 | + {"/nope", 404, ""}, // NotFound | |
50 | } | |
51 | for _, tr := range testRoutes { | |
52 | r, _ := http.NewRequest("GET", tr.route, nil) | |
53 | w := httptest.NewRecorder() | |
54 | router.ServeHTTP(w, r) | |
55 | - if !(w.Code == tr.code && (w.Code == 404 || fmt.Sprint(w.Header()) == tr.header)) { | |
56 | - t.Errorf("NotFound handling route %s failed: Code=%d, Header=%v", tr.route, w.Code, w.Header()) | |
57 | + if !(w.Code == tr.code && (w.Code == 404 || fmt.Sprint(w.Header().Get("Location")) == tr.location)) { | |
58 | + t.Errorf("NotFound handling route %s failed: Code=%d, Header=%v", tr.route, w.Code, w.Header().Get("Location")) | |
59 | } | |
60 | } | |
61 |