Request with already encoded URL
To keep explanation simple if you want to send a request to an already encoded URL use Opaque property of url.URL
// Sending a literal '%' in an HTTP request's Path
req := &http.Request{
Method: "GET",
Host: "example.com", // takes precendence over URL.Host
URL: &url.URL{
Opaque: "/%2f/",
},
}
On the other hand you may not want your url to be encoded
req, err := http.NewRequest("GET", "https://api.linkedin.com", nil)
req.URL.Opaque = "/v1/people/~:(id,first-name,last-name)"
resp, err = http.DefaultClient.Do(req)