Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(161)

Unified Diff: src/pkg/http/client.go

Issue 2985042: code review 2985042: http: Add EncodeQuery, a handy helper function for cons... (Closed)
Patch Set: code review 2985042: http: Add EncodeQuery, a handy helper function for cons... Created 14 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Please Sign in to add in-line comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | src/pkg/http/url.go » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/pkg/http/client.go
===================================================================
--- a/src/pkg/http/client.go
+++ b/src/pkg/http/client.go
@@ -199,20 +199,13 @@
return send(&req)
}
+// TODO: remove this function when PostForm takes a multimap.
func urlencode(data map[string]string) (b *bytes.Buffer) {
- b = new(bytes.Buffer)
- first := true
+ m := make(map[string][]string, len(data))
for k, v := range data {
- if first {
- first = false
- } else {
- b.WriteByte('&')
- }
- b.WriteString(URLEscape(k))
- b.WriteByte('=')
- b.WriteString(URLEscape(v))
+ m[k] = []string{v}
}
- return
+ return bytes.NewBuffer([]byte(EncodeQuery(m)))
}
// Head issues a HEAD to the specified URL.
« no previous file with comments | « no previous file | src/pkg/http/url.go » ('j') | no next file with comments »

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b