(c *C)
| 230 | } |
| 231 | |
| 232 | func (s *RewriteSuite) TestRewritePreserveQuery(c *C) { |
| 233 | var outURL string |
| 234 | handler := http.HandlerFunc(func(w http.ResponseWriter, req *http.Request) { |
| 235 | outURL = rawURL(req) |
| 236 | w.Write([]byte("hello")) |
| 237 | }) |
| 238 | |
| 239 | rh, err := newRewriteHandler(handler, &Rewrite{"^http://localhost/foo(.*)", "http://localhost$1", false, false}) |
| 240 | c.Assert(rh, NotNil) |
| 241 | c.Assert(err, IsNil) |
| 242 | |
| 243 | srv := httptest.NewServer(rh) |
| 244 | defer srv.Close() |
| 245 | |
| 246 | re, _, err := testutils.Get(srv.URL+"/foo/bar?a=b", testutils.Host("localhost")) |
| 247 | c.Assert(err, IsNil) |
| 248 | c.Assert(re.StatusCode, Equals, http.StatusOK) |
| 249 | c.Assert(outURL, Equals, "http://localhost/bar?a=b") |
| 250 | } |
| 251 | |
| 252 | func (s *RewriteSuite) TestRewriteInQuery(c *C) { |
| 253 | var outURL string |
nothing calls this directly
no test coverage detected