无论如何golang HTTP客户端,不要逃避请求的URL.
例如,对URL"/ test(a)"的请求被转义为"/ test%28a%29".
我正在运行https://github.com/cmpxchg16/gobench中的代码
您可以设置不透明的网址.
假设您希望网址指向http://example.com/test(a)
您想要执行的操作:
req.NewRequest("GET", "http://example.com/test(a)", nil) req.URL = &url.URL{ Scheme: "http", Host: "example.com", Opaque: "//example.com/test(a)", } client.Do(req)
示例:http://play.golang.org/p/09V67Hbo6H
文档:http://golang.org/pkg/net/url/#URL