LEFT | RIGHT |
1 // Copyright 2010 The Go Authors. All rights reserved. | 1 // Copyright 2010 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 package http | 5 package http |
6 | 6 |
7 import ( | 7 import ( |
8 "bytes" | 8 "bytes" |
9 "testing" | 9 "testing" |
10 ) | 10 ) |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
46 Close: false, | 46 Close: false, |
47 Host: "www.techcrunch.com", | 47 Host: "www.techcrunch.com", |
48 Referer: "", | 48 Referer: "", |
49 UserAgent: "Fake", | 49 UserAgent: "Fake", |
50 Form: map[string][]string{}, | 50 Form: map[string][]string{}, |
51 }, | 51 }, |
52 | 52 |
53 "GET http://www.techcrunch.com/ HTTP/1.1\r\n" + | 53 "GET http://www.techcrunch.com/ HTTP/1.1\r\n" + |
54 "Host: www.techcrunch.com\r\n" + | 54 "Host: www.techcrunch.com\r\n" + |
55 "User-Agent: Fake\r\n" + | 55 "User-Agent: Fake\r\n" + |
| 56 "Accept: text/html,application/xhtml+xml,application/xml
;q=0.9,*/*;q=0.8\r\n" + |
56 "Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7\r\n" + | 57 "Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7\r\n" + |
57 "Accept-Encoding: gzip,deflate\r\n" + | 58 "Accept-Encoding: gzip,deflate\r\n" + |
58 "Accept-Language: en-us,en;q=0.5\r\n" + | 59 "Accept-Language: en-us,en;q=0.5\r\n" + |
59 "Accept: text/html,application/xhtml+xml,application/xml
;q=0.9,*/*;q=0.8\r\n" + | |
60 "Keep-Alive: 300\r\n" + | 60 "Keep-Alive: 300\r\n" + |
61 "Proxy-Connection: keep-alive\r\n\r\n", | 61 "Proxy-Connection: keep-alive\r\n\r\n", |
62 }, | 62 }, |
63 // HTTP/1.1 => chunked coding; body; empty trailer | 63 // HTTP/1.1 => chunked coding; body; empty trailer |
64 { | 64 { |
65 Request{ | 65 Request{ |
66 Method: "GET", | 66 Method: "GET", |
67 URL: &URL{ | 67 URL: &URL{ |
68 Scheme: "http", | 68 Scheme: "http", |
69 Host: "www.google.com", | 69 Host: "www.google.com", |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
130 t.Errorf("error writing #%d: %s", i, err) | 130 t.Errorf("error writing #%d: %s", i, err) |
131 continue | 131 continue |
132 } | 132 } |
133 sraw := braw.String() | 133 sraw := braw.String() |
134 if sraw != tt.Raw { | 134 if sraw != tt.Raw { |
135 t.Errorf("Test %d, expecting:\n%s\nGot:\n%s\n", i, tt.Ra
w, sraw) | 135 t.Errorf("Test %d, expecting:\n%s\nGot:\n%s\n", i, tt.Ra
w, sraw) |
136 continue | 136 continue |
137 } | 137 } |
138 } | 138 } |
139 } | 139 } |
LEFT | RIGHT |