Answer the question
In order to leave comments, you need to log in
How to make a post request to a third-party service?
Good afternoon.
I will send a post request to a third-party service:
Code
req, err := http.NewRequest("POST", "http://api.site.com/ajax/test", nil)
req.Header.Set("Content-Type", "application/json")
client := &http.Client{}
resp, err := client.Do(req)
defer resp.Body.Close()
if err != nil {
panic(err)
}
{
"success": false,
"error": "Invalid request"
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question