Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Golang Example for adding custom headers to a request.
client := &http.Client{]
req, err := http.NewRequest("POST", "", bytes.NewReader(postData))
req.Header.Add("User-Agent", "myClient")
resp, err := client.Do(req)
defer resp.Body.Close()
Copy link

R4wm commented Sep 13, 2016

http.Client right square bracket should be a right curly brace

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment