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
http.Client right square bracket should be a right curly brace
https://gist.github.com/R4wm/405eb358e9383dc8457a55025d0a8d68