Skip to content

Commit

Permalink
net/http: gofmt -w -s
Browse files Browse the repository at this point in the history
Change-Id: I6815a8560dd9fe0a0ebd485a0693f7044ba09848
Reviewed-on: https://go-review.googlesource.com/32137
Reviewed-by: Brad Fitzpatrick <[email protected]>
Run-TryBot: Brad Fitzpatrick <[email protected]>
TryBot-Result: Gobot Gobot <[email protected]>
  • Loading branch information
cixtor authored and bradfitz committed Oct 26, 2016
1 parent d6625ca commit 6d9c8c9
Showing 1 changed file with 20 additions and 20 deletions.
40 changes: 20 additions & 20 deletions src/net/http/client_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1315,43 +1315,43 @@ func TestClientAltersCookiesOnRedirect(t *testing.T) {
switch c.Value {
case "0":
want = map[string][]string{
"Cookie1": []string{"OldValue1a", "OldValue1b"},
"Cookie2": []string{"OldValue2"},
"Cookie3": []string{"OldValue3a", "OldValue3b"},
"Cookie4": []string{"OldValue4"},
"Cycle": []string{"0"},
"Cookie1": {"OldValue1a", "OldValue1b"},
"Cookie2": {"OldValue2"},
"Cookie3": {"OldValue3a", "OldValue3b"},
"Cookie4": {"OldValue4"},
"Cycle": {"0"},
}
SetCookie(w, &Cookie{Name: "Cycle", Value: "1", Path: "/"})
SetCookie(w, &Cookie{Name: "Cookie2", Path: "/", MaxAge: -1}) // Delete cookie from Header
Redirect(w, r, "/", StatusFound)
case "1":
want = map[string][]string{
"Cookie1": []string{"OldValue1a", "OldValue1b"},
"Cookie3": []string{"OldValue3a", "OldValue3b"},
"Cookie4": []string{"OldValue4"},
"Cycle": []string{"1"},
"Cookie1": {"OldValue1a", "OldValue1b"},
"Cookie3": {"OldValue3a", "OldValue3b"},
"Cookie4": {"OldValue4"},
"Cycle": {"1"},
}
SetCookie(w, &Cookie{Name: "Cycle", Value: "2", Path: "/"})
SetCookie(w, &Cookie{Name: "Cookie3", Value: "NewValue3", Path: "/"}) // Modify cookie in Header
SetCookie(w, &Cookie{Name: "Cookie4", Value: "NewValue4", Path: "/"}) // Modify cookie in Jar
Redirect(w, r, "/", StatusFound)
case "2":
want = map[string][]string{
"Cookie1": []string{"OldValue1a", "OldValue1b"},
"Cookie3": []string{"NewValue3"},
"Cookie4": []string{"NewValue4"},
"Cycle": []string{"2"},
"Cookie1": {"OldValue1a", "OldValue1b"},
"Cookie3": {"NewValue3"},
"Cookie4": {"NewValue4"},
"Cycle": {"2"},
}
SetCookie(w, &Cookie{Name: "Cycle", Value: "3", Path: "/"})
SetCookie(w, &Cookie{Name: "Cookie5", Value: "NewValue5", Path: "/"}) // Insert cookie into Jar
Redirect(w, r, "/", StatusFound)
case "3":
want = map[string][]string{
"Cookie1": []string{"OldValue1a", "OldValue1b"},
"Cookie3": []string{"NewValue3"},
"Cookie4": []string{"NewValue4"},
"Cookie5": []string{"NewValue5"},
"Cycle": []string{"3"},
"Cookie1": {"OldValue1a", "OldValue1b"},
"Cookie3": {"NewValue3"},
"Cookie4": {"NewValue4"},
"Cookie5": {"NewValue5"},
"Cycle": {"3"},
}
// Don't redirect to ensure the loop ends.
default:
Expand Down Expand Up @@ -1380,8 +1380,8 @@ func TestClientAltersCookiesOnRedirect(t *testing.T) {
req.AddCookie(&Cookie{Name: "Cookie2", Value: "OldValue2"})
req.AddCookie(&Cookie{Name: "Cookie3", Value: "OldValue3a"})
req.AddCookie(&Cookie{Name: "Cookie3", Value: "OldValue3b"})
jar.SetCookies(u, []*Cookie{&Cookie{Name: "Cookie4", Value: "OldValue4", Path: "/"}})
jar.SetCookies(u, []*Cookie{&Cookie{Name: "Cycle", Value: "0", Path: "/"}})
jar.SetCookies(u, []*Cookie{{Name: "Cookie4", Value: "OldValue4", Path: "/"}})
jar.SetCookies(u, []*Cookie{{Name: "Cycle", Value: "0", Path: "/"}})
res, err := c.Do(req)
if err != nil {
t.Fatal(err)
Expand Down

0 comments on commit 6d9c8c9

Please sign in to comment.