return
}
-
// Post issues a POST to the specified URL.
//
// Caller should close r.Body when done reading it.
return send(&req)
}
+// Head issues a HEAD to the specified URL.
+func Head(url string) (r *Response, err os.Error) {
+ var req Request
+ req.Method = "HEAD"
+ if req.URL, err = ParseURL(url); err != nil {
+ return
+ }
+ if r, err = send(&req); err != nil {
+ return
+ }
+ return
+}
+
type nopCloser struct {
io.Reader
}
t.Errorf("Incorrect page body (did not begin with User-agent): %q", s)
}
}
+
+func TestClientHead(t *testing.T) {
+ r, err := Head("http://www.google.com/robots.txt")
+ if err != nil {
+ t.Error(err)
+ }
+ if _, ok := r.Header["Last-Modified"]; !ok {
+ t.Error("Last-Modified header not found.")
+ }
+}