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

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

Issue 4535056: code review 4535056: http: remove finalURL from Client.Get; move to Response (Closed)
Left Patch Set: Created 13 years, 10 months ago
Right Patch Set: diff -r f92afedc0ac0 https://go.googlecode.com/hg/ Created 13 years, 10 months 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:
Right: Side by side diff | Download
« no previous file with change/comment | « src/pkg/http/persist.go ('k') | src/pkg/http/response.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
(no file at all)
1 // Copyright 2009 The Go Authors. All rights reserved. 1 // Copyright 2009 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_test 5 package http_test
6 6
7 import ( 7 import (
8 "bytes" 8 "bytes"
9 "fmt" 9 "fmt"
10 . "http" 10 . "http"
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after
155 w.WriteHeader(StatusSeeOther) 155 w.WriteHeader(StatusSeeOther)
156 case "/foo/": 156 case "/foo/":
157 fmt.Fprintf(w, "foo") 157 fmt.Fprintf(w, "foo")
158 default: 158 default:
159 w.WriteHeader(StatusBadRequest) 159 w.WriteHeader(StatusBadRequest)
160 } 160 }
161 })) 161 }))
162 defer ts.Close() 162 defer ts.Close()
163 163
164 var end = regexp.MustCompile("/foo/$") 164 var end = regexp.MustCompile("/foo/$")
165 » r, url, err := Get(ts.URL) 165 » r, err := Get(ts.URL)
166 if err != nil { 166 if err != nil {
167 t.Fatal(err) 167 t.Fatal(err)
168 } 168 }
169 r.Body.Close() 169 r.Body.Close()
170 url := r.Request.URL.String()
170 if r.StatusCode != 200 || !end.MatchString(url) { 171 if r.StatusCode != 200 || !end.MatchString(url) {
171 t.Fatalf("Get got status %d at %q, want 200 matching /foo/$", r. StatusCode, url) 172 t.Fatalf("Get got status %d at %q, want 200 matching /foo/$", r. StatusCode, url)
172 } 173 }
173 } 174 }
174 175
175 func TestMultipartRequest(t *testing.T) { 176 func TestMultipartRequest(t *testing.T) {
176 // Test that we can read the values and files of a· 177 // Test that we can read the values and files of a·
177 // multipart request with FormValue and FormFile, 178 // multipart request with FormValue and FormFile,
178 // and that ParseMultipartForm can be called multiple times. 179 // and that ParseMultipartForm can be called multiple times.
179 req := newTestMultipartRequest(t) 180 req := newTestMultipartRequest(t)
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after
305 --MyBoundary 306 --MyBoundary
306 Content-Disposition: form-data; name="texta" 307 Content-Disposition: form-data; name="texta"
307 308
308 ` + textaValue + ` 309 ` + textaValue + `
309 --MyBoundary 310 --MyBoundary
310 Content-Disposition: form-data; name="textb" 311 Content-Disposition: form-data; name="textb"
311 312
312 ` + textbValue + ` 313 ` + textbValue + `
313 --MyBoundary-- 314 --MyBoundary--
314 ` 315 `
LEFTRIGHT

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