I have seen different ways to do this, but when I print the URL getting sent it is not adding the ?foo=bar
to the URL. I am trying to accomplish a URL like this https://blah.com/blah?foo=bar
that get posted. My code is similar the simplified below.
baseURL := "https://blah.com/blah"
data := url.Values{}
data.Set("foo", "bar")
req, err := http.NewRequest("POST", baseURL, strings.NewReader(data.Encode()))
req.Header.Add("Content-Type", "application/x-www-form-urlencoded")
fmt.Printf("%v", req)
So, I am not sure where I am going wrong and any help would be appreciated.