(c *C)
| 191 | } |
| 192 | |
| 193 | func (s *RewriteSuite) TestUnknownHeader(c *C) { |
| 194 | var outURL string |
| 195 | handler := http.HandlerFunc(func(w http.ResponseWriter, req *http.Request) { |
| 196 | outURL = rawURL(req) |
| 197 | w.Write([]byte("hello")) |
| 198 | }) |
| 199 | |
| 200 | rh, err := newRewriteHandler(handler, |
| 201 | &Rewrite{"^http://localhost/(foo)/(bar)$", `http://localhost/$1/{{.Request.Header.Get "X-Header"}}/$2`, false, false}) |
| 202 | c.Assert(rh, NotNil) |
| 203 | c.Assert(err, IsNil) |
| 204 | |
| 205 | srv := httptest.NewServer(rh) |
| 206 | defer srv.Close() |
| 207 | |
| 208 | re, _, err := testutils.Get(srv.URL+"/foo/bar", testutils.Host("localhost")) |
| 209 | c.Assert(err, IsNil) |
| 210 | c.Assert(re.StatusCode, Equals, http.StatusOK) |
| 211 | c.Assert(outURL, Equals, "http://localhost/foo//bar") |
| 212 | } |
| 213 | |
| 214 | func (s *RewriteSuite) TestUnknownVar(c *C) { |
| 215 | handler := http.HandlerFunc(func(w http.ResponseWriter, _ *http.Request) { |
nothing calls this directly
no test coverage detected