E
E
ezpy2018-01-26 20:49:02
go
ezpy, 2018-01-26 20:49:02

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)
  }

But, in response from the site, this arrives
{
  "success": false,
  "error": "Invalid request"
}

I checked, maybe the site sends additional. headers, but no.
5a6b693f62d33064116308.png
As I understand it, this site somehow verifies post requests.
The site does not check the session and this request quietly passes from the browser, looked at the js of this site and it also sends a standard ajax request without additional. parameters.
Perhaps someone has come across something similar?

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question