How to disable auto redirect in httptest?
Open
- Dominant language
- Go
- Stars
- 25.6k
- Forks
- 2.4k
- PR merge metrics
- No merged PRs in 30d
Description
I have api router need `ctx.Redirect(targetURL, statusCode)`, I want to check the `targetURL` is ok,
```
app.get("/a", func(ctx iris.Context){
ctx.Redirect("https://google.com", 302)
})
```
i write test like :
```
func TestCreate(t *testing.T) {
t.Run("301 check", func(t *testing.T) {
e := httptest.New(t, TestServer)
tt := e.GET("/a").
response := tt.Expect()
response.Status(301)
fmt.Println(response.Header("Location").Raw())
})
}
```
the http request will request `google.com` but it's not my expect result, i just want to get 301 and the text in http header `location`
how to disable request auto redirect and let test pass?
Contributor guide
Assessment
This issue has not been assessed yet.