Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(205)

Delta Between Two Patch Sets: src/pkg/http/serve_test.go

Issue 4185053: code review 4185053: http: introduce Header type, implement with net/textproto (Closed)
Left Patch Set: diff -r 8e157f1abc87 https://go.googlecode.com/hg/ Created 14 years, 1 month ago
Right Patch Set: diff -r 2058371f94f0 https://go.googlecode.com/hg/ Created 14 years, 1 month ago
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments. Please Sign in to add in-line comments.
Jump to:
Left: Side by side diff | Download
Right: Side by side diff | Download
« no previous file with change/comment | « src/pkg/http/responsewrite_test.go ('k') | src/pkg/http/transfer.go » ('j') | no next file with change/comment »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
LEFTRIGHT
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 // End-to-end serving tests 5 // End-to-end serving tests
6 6
7 package http 7 package http
8 8
9 import ( 9 import (
10 "bufio" 10 "bufio"
(...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after
190 } 190 }
191 if err := cc.Write(&req); err != nil { 191 if err := cc.Write(&req); err != nil {
192 t.Errorf("writing request: %v", err) 192 t.Errorf("writing request: %v", err)
193 continue 193 continue
194 } 194 }
195 r, err := cc.Read(&req) 195 r, err := cc.Read(&req)
196 if err != nil { 196 if err != nil {
197 t.Errorf("reading response: %v", err) 197 t.Errorf("reading response: %v", err)
198 continue 198 continue
199 } 199 }
200 » » s_, ok := r.Header["Result"] 200 » » s := r.Header.Get("Result")
rsc 2011/02/22 21:53:44 s := r.Header.Get("Result")
petar-m 2011/02/22 23:18:44 Done.
201 » » if !ok || s_[0] != vt.expected { 201 » » if s != vt.expected {
202 » » » t.Errorf("Get(%q) = %q, want %q", vt.url, s_[0], vt.expe cted) 202 » » » t.Errorf("Get(%q) = %q, want %q", vt.url, s, vt.expected )
mattn 2011/02/18 13:26:57 if ok is false, s_ will be nil. Then it will be pa
petar-m 2011/02/22 23:18:44 Done.
203 } 203 }
204 } 204 }
205 } 205 }
206 206
207 type responseWriterMethodCall struct { 207 type responseWriterMethodCall struct {
208 method string 208 method string
209 headerKey, headerValue string // if method == "SetHeader" 209 headerKey, headerValue string // if method == "SetHeader"
210 bytesWritten []byte // if method == "Write" 210 bytesWritten []byte // if method == "Write"
211 responseCode int // if method == "WriteHeader" 211 responseCode int // if method == "WriteHeader"
212 } 212 }
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after
342 t.Fatalf("http Get #2: %v", err) 342 t.Fatalf("http Get #2: %v", err)
343 } 343 }
344 got, _ = ioutil.ReadAll(r.Body) 344 got, _ = ioutil.ReadAll(r.Body)
345 expected = "req=2" 345 expected = "req=2"
346 if string(got) != expected { 346 if string(got) != expected {
347 t.Errorf("Get #2 got %q, want %q", string(got), expected) 347 t.Errorf("Get #2 got %q, want %q", string(got), expected)
348 } 348 }
349 349
350 l.Close() 350 l.Close()
351 } 351 }
LEFTRIGHT

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b