Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Golang Example for adding custom headers to a request.
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()
@R4wm

This comment has been minimized.

Copy link

@R4wm R4wm commented Sep 13, 2016

http.Client right square bracket should be a right curly brace
https://gist.github.com/R4wm/405eb358e9383dc8457a55025d0a8d68

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