~john-koepi/ubuntu/trusty/golang/default

« back to all changes in this revision

Viewing changes to src/pkg/net/http/client_test.go

  • Committer: Package Import Robot
  • Author(s): Ondřej Surý, Ondřej Surý, Michael Stapelberg
  • Date: 2012-06-28 12:14:15 UTC
  • mfrom: (1.1.15)
  • mto: (3.1.5 experimental) (14.3.1 saucy)
  • mto: This revision was merged to the branch mainline in revision 24.
  • Revision ID: package-import@ubuntu.com-20120628121415-w1b0076ixkarr1ml
[ Ondřej Surý ]
* Imported Upstream version 1.0.2
* Update Vcs fields to reflect new git repository location
* Kill get-orig-source, since 1.0.0, the tarballs can be downloaded
  from webpage

[ Michael Stapelberg ]
* golang-mode: use debian-pkg-add-load-path-item (Closes: #664802)
* Add manpages (Closes: #632964)
* Use updated pt.po from Pedro Ribeiro (Closes: #674958)

Show diffs side-by-side

added added

removed removed

Lines of Context:
256
256
        }
257
257
})
258
258
 
 
259
func TestClientSendsCookieFromJar(t *testing.T) {
 
260
        tr := &recordingTransport{}
 
261
        client := &Client{Transport: tr}
 
262
        client.Jar = &TestJar{perURL: make(map[string][]*Cookie)}
 
263
        us := "http://dummy.faketld/"
 
264
        u, _ := url.Parse(us)
 
265
        client.Jar.SetCookies(u, expectedCookies)
 
266
 
 
267
        client.Get(us) // Note: doesn't hit network
 
268
        matchReturnedCookies(t, expectedCookies, tr.req.Cookies())
 
269
 
 
270
        client.Head(us) // Note: doesn't hit network
 
271
        matchReturnedCookies(t, expectedCookies, tr.req.Cookies())
 
272
 
 
273
        client.Post(us, "text/plain", strings.NewReader("body")) // Note: doesn't hit network
 
274
        matchReturnedCookies(t, expectedCookies, tr.req.Cookies())
 
275
 
 
276
        client.PostForm(us, url.Values{}) // Note: doesn't hit network
 
277
        matchReturnedCookies(t, expectedCookies, tr.req.Cookies())
 
278
 
 
279
        req, _ := NewRequest("GET", us, nil)
 
280
        client.Do(req) // Note: doesn't hit network
 
281
        matchReturnedCookies(t, expectedCookies, tr.req.Cookies())
 
282
}
 
283
 
259
284
// Just enough correctness for our redirect tests. Uses the URL.Host as the
260
285
// scope of all cookies.
261
286
type TestJar struct {