1 // Copyright 2009 The Go Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style
3 // license that can be found in the LICENSE file.
15 func TestClient(t
*testing
.T
) {
16 // TODO: add a proper test suite. Current test merely verifies that
17 // we can retrieve the Google robots.txt file.
19 r
, _
, err
:= Get("http://www.google.com/robots.txt")
22 b
, err
= ioutil
.ReadAll(r
.Body
)
27 } else if s
:= string(b
); !strings
.HasPrefix(s
, "User-agent:") {
28 t
.Errorf("Incorrect page body (did not begin with User-agent): %q", s
)
32 func TestClientHead(t
*testing
.T
) {
33 r
, err
:= Head("http://www.google.com/robots.txt")
37 if _
, ok
:= r
.Header
["Last-Modified"]; !ok
{
38 t
.Error("Last-Modified header not found.")