// Write writes an HTTP/1.1 request -- header and body -- in wire format.
// This method consults the following fields of req:
// Host
-// URL
+// RawURL, if non-empty, or else URL
// Method (defaults to "GET")
// UserAgent (defaults to defaultUserAgent)
// Referer
host = req.URL.Host
}
- uri := valueOrDefault(urlEscape(req.URL.Path, false), "/")
- if req.URL.RawQuery != "" {
- uri += "?" + req.URL.RawQuery
+ uri := req.RawURL
+ if uri == "" {
+ uri = valueOrDefault(urlEscape(req.URL.Path, false), "/")
+ if req.URL.RawQuery != "" {
+ uri += "?" + req.URL.RawQuery
+ }
}
fmt.Fprintf(w, "%s %s HTTP/1.1\r\n", valueOrDefault(req.Method, "GET"), uri)
Form: map[string][]string{},
},
- "GET / HTTP/1.1\r\n" +
+ "GET http://www.techcrunch.com/ HTTP/1.1\r\n" +
"Host: www.techcrunch.com\r\n" +
"User-Agent: Fake\r\n" +
"Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7\r\n" +