This article describes the method of adding a custom http header when requesting http. Share it for your reference. The specific implementation method is as follows:
Copy the codeThe code is as follows:
client := &{]
req, err := ("POST", "", (postData))
("User-Agent", "myClient")
resp, err := (req)
defer ()
I hope this article will be helpful to everyone's Go language programming.