Closed abelikoff closed 3 years ago
OK, my mistake - the expectation is to POST a form with the values above. After some trial and error, the following code solved the problem:
params := url.Values{
"download": {"Download"},
}
encoded := params.Encode()
payloadBuf := new(bytes.Buffer)
payloadBuf.WriteString(encoded)
req.HTTPRequest, err = http.NewRequest("POST", url, payloadBuf)
req.HTTPRequest.Header.Set("Referer", url)
req.HTTPRequest.Header.Set("Content-Type", "application/x-www-form-urlencoded")
I'm trying to download from a website which is a bit peculiar. In order to initiate the download it uses a GET request but also requires form data (as key/value pairs):
What would be the recommended way to set the form parameters?
I've tried setting the Form parameter directly via
..but it doesn't seem to pass the form data to the server. Is there a recommended way to accomplish this?