-
-
Save thurt/9d3998045e3160dec4e73c2855e0fcf2 to your computer and use it in GitHub Desktop.
Golang Example for adding custom headers to a request.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
client := &http.Client{] | |
req, err := http.NewRequest("POST", "http://example.com", bytes.NewReader(postData)) | |
req.Header.Add("User-Agent", "myClient") | |
resp, err := client.Do(req) | |
defer resp.Body.Close() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment