Unreviewed changes
1 is the latest approved patch-set.
The change was submitted with unreviewed changes in the following files:
```
The name of the file: src/net/http/client_test.go
Insertions: 3, Deletions: 43.
@@ -346,7 +346,7 @@
`POST /?code=307&next=303,308,302 "c307"`,
`POST /?code=303&next=308,302 "c307"`,
`GET /?code=308&next=302 ""`,
- `GET /?code=302 "c307"`,
+ `GET /?code=302 ""`,
`GET / ""`,
`POST /?code=308&next=302,301 "c308"`,
`POST /?code=302&next=301 "c308"`,
@@ -376,7 +376,7 @@
`DELETE /?code=301&next=302,308 "c301"`,
`GET /?code=302&next=308 ""`,
`GET /?code=308 ""`,
- `GET / "c301"`,
+ `GET / ""`,
`DELETE /?code=302&next=302 "c302"`,
`GET /?code=302 ""`,
`GET / ""`,
@@ -385,7 +385,7 @@
`DELETE /?code=307&next=301,308,303,302,304 "c307"`,
`DELETE /?code=301&next=308,303,302,304 "c307"`,
`GET /?code=308&next=303,302,304 ""`,
- `GET /?code=303&next=302,304 "c307"`,
+ `GET /?code=303&next=302,304 ""`,
`GET /?code=302&next=304 ""`,
`GET /?code=304 ""`,
`DELETE /?code=308&next=307 "c308"`,
@@ -566,46 +566,6 @@
}
}
-// If we follow a redirect chain from a 301 to a 308,
-// the 301 changes the request to a GET with no body and
-// the 308 should not use the original method or body.
-func TestClientRedirect301To308WithBody(t *testing.T) { run(t, testClientRedirect301To308WithBody) }
-func testClientRedirect301To308WithBody(t *testing.T, mode testMode) {
- const body = "hello"
- ts := newClientServerTest(t, mode, HandlerFunc(func(rw ResponseWriter, req *Request) {
- t.Log(req.Method, req.URL.Path, string(body))
- var wantMethod, wantBody string
- switch req.URL.Path {
- case "/":
- wantMethod = "POST"
- wantBody = body
- rw.Header().Set("Location", "/1")
- rw.WriteHeader(301)
- case "/1":
- wantMethod = "GET"
- wantBody = ""
- rw.Header().Set("Location", "/2")
- rw.WriteHeader(308)
- case "/2":
- wantMethod = "GET"
- wantBody = ""
- }
- if got, want := req.Method, wantMethod; got != want {
- t.Errorf("request to %q: method = %v, want %v", req.URL.Path, got, want)
- }
- gotBody, _ := io.ReadAll(req.Body)
- if got, want := string(gotBody), wantBody; got != want {
- t.Errorf("request to %q: body = %q, want %q", req.URL.Path, got, want)
- }
- })).ts
- buf := bytes.NewBuffer([]byte(body))
- req, _ := NewRequest("POST", ts.URL, buf)
- resp, _ := ts.Client().Do(req)
- if resp != nil {
- resp.Body.Close()
- }
-}
-
var expectedCookies = []*Cookie{
{Name: "ChocolateChip", Value: "tasty"},
{Name: "First", Value: "Hit"},
```