-
-
Save farhany/6236330c4eeb4a31bb68f582c7de6642 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