Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Required fields*

5
  • Any solution to make the query string parameters in your wanted order? The keys are sorted in Encode() method. Commented Jan 13, 2018 at 10:48
  • 1
    @artificerpi if it was critical for some reason you could reimplement what they do inside the Encode method golang.org/src/net/url/url.go?s=24222:24253#L845 But I would wonder why it mattered. Commented Jan 15, 2018 at 18:58
  • 5
    You don't need to use NewRequest if you're not doing anything with it. You can just use url.Parse("https://something.com/") instead or even create an URL object directly. Commented Mar 25, 2019 at 5:43
  • one thing that is confusing me in this is that it reads like the OP first makes the request, and then after it's finished, goes back and updates the URL. I'm sure that's not the case, so hoping someone can clear up for me why we're first making the API call and then setting the URL we need Commented Sep 5, 2020 at 22:19
  • 3
    @JakeBoomgaarden the http.NewRequest function does not actually call the remote server. It just constructs a *http.Request variable for you to use. You can tweak the request to your liking then send it off by passing it to the *http.Client.Do method. Commented Sep 8, 2020 at 19:52