LEFT | RIGHT |
1 // Copyright 2011 The Go Authors. All rights reserved. | 1 // Copyright 2011 The Go Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style | 2 // Use of this source code is governed by a BSD-style |
3 // license that can be found in the LICENSE file. | 3 // license that can be found in the LICENSE file. |
4 | 4 |
5 // Reverse proxy tests. | 5 // Reverse proxy tests. |
6 | 6 |
7 package http_test | 7 package http_test |
8 | 8 |
9 import ( | 9 import ( |
10 . "http" | 10 . "http" |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
45 } | 45 } |
46 if g, e := res.StatusCode, backendStatus; g != e { | 46 if g, e := res.StatusCode, backendStatus; g != e { |
47 t.Errorf("got res.StatusCode %d; expected %d", g, e) | 47 t.Errorf("got res.StatusCode %d; expected %d", g, e) |
48 } | 48 } |
49 if g, e := res.Header.Get("X-Foo"), "bar"; g != e { | 49 if g, e := res.Header.Get("X-Foo"), "bar"; g != e { |
50 t.Errorf("got X-Foo %q; expected %q", g, e) | 50 t.Errorf("got X-Foo %q; expected %q", g, e) |
51 } | 51 } |
52 if g, e := len(res.Header["Set-Cookie"]), 1; g != e { | 52 if g, e := len(res.Header["Set-Cookie"]), 1; g != e { |
53 t.Fatalf("got %d SetCookies, want %d", g, e) | 53 t.Fatalf("got %d SetCookies, want %d", g, e) |
54 } | 54 } |
55 » if cookie := res.SetCookies()[0]; cookie.Name != "flavor" { | 55 » if cookie := res.Cookies()[0]; cookie.Name != "flavor" { |
56 t.Errorf("unexpected cookie %q", cookie.Name) | 56 t.Errorf("unexpected cookie %q", cookie.Name) |
57 } | 57 } |
58 bodyBytes, _ := ioutil.ReadAll(res.Body) | 58 bodyBytes, _ := ioutil.ReadAll(res.Body) |
59 if g, e := string(bodyBytes), backendResponse; g != e { | 59 if g, e := string(bodyBytes), backendResponse; g != e { |
60 t.Errorf("got body %q; expected %q", g, e) | 60 t.Errorf("got body %q; expected %q", g, e) |
61 } | 61 } |
62 } | 62 } |
LEFT | RIGHT |