Skip to content

Instantly share code, notes, and snippets.

@blue-bird1
Last active October 10, 2018 00:16
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save blue-bird1/0f61cf3a75926b185fb97327231c7d9d to your computer and use it in GitHub Desktop.
Save blue-bird1/0f61cf3a75926b185fb97327231c7d9d to your computer and use it in GitHub Desktop.
go http set header #golang
client := &http.Client{}
req, err := http.NewRequest("POST", "http://example.com",string.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