Commit 1726e81c authored by Rob Pike's avatar Rob Pike

publish Request.Write (rename from Request.write)

R=rsc
CC=go-dev
http://go/go-review/1015003
parent b74fd8ec
...@@ -125,7 +125,7 @@ func send(req *Request) (resp *Response, err os.Error) { ...@@ -125,7 +125,7 @@ func send(req *Request) (resp *Response, err os.Error) {
return nil, err; return nil, err;
} }
err = req.write(conn); err = req.Write(conn);
if err != nil { if err != nil {
conn.Close(); conn.Close();
return nil, err; return nil, err;
......
...@@ -125,7 +125,7 @@ func valueOrDefault(value, def string) string { ...@@ -125,7 +125,7 @@ func valueOrDefault(value, def string) string {
// TODO(rsc): Change default UserAgent before open-source release. // TODO(rsc): Change default UserAgent before open-source release.
const defaultUserAgent = "http.Client" const defaultUserAgent = "http.Client"
// Write an HTTP/1.1 request -- header and body -- in wire format. // Write writes an HTTP/1.1 request -- header and body -- in wire format.
// This method consults the following fields of req: // This method consults the following fields of req:
// Url // Url
// Method (defaults to "GET") // Method (defaults to "GET")
...@@ -135,7 +135,7 @@ const defaultUserAgent = "http.Client" ...@@ -135,7 +135,7 @@ const defaultUserAgent = "http.Client"
// Body // Body
// //
// If Body is present, "Transfer-Encoding: chunked" is forced as a header. // If Body is present, "Transfer-Encoding: chunked" is forced as a header.
func (req *Request) write(w io.Writer) os.Error { func (req *Request) Write(w io.Writer) os.Error {
uri := URLEscape(req.Url.Path); uri := URLEscape(req.Url.Path);
if req.Url.RawQuery != "" { if req.Url.RawQuery != "" {
uri += "?" + req.Url.RawQuery; uri += "?" + req.Url.RawQuery;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment