V
V
Vyacheslav Shevchenko2019-11-11 22:12:23
Node.js
Vyacheslav Shevchenko, 2019-11-11 22:12:23

Why does the request pass through cURL, but I get 429 through nodeJS?

I am writing a request for a third-party service.
If you run curl -I then the answer is normal and complete.
If I write:

request(url, options.requestOptions, function(err, res, body) {
   console.log(body);
});

That apparently does not reach the callback.
And if I write
axios({
    ...options.requestOptions,
    method: 'get',
    url: url
  }).then((resp) => {
    console.log(resp.data);
    callback('axios done');
  }).catch((err) => {
    console.log(err.response.status);
    console.log(err.response.headers);
    callback('error');
  }).finally(() => { })

Then an error is triggered and I get status 429, they say there are too many requests.
My answer should come in chunks Transfer-Encoding: chunked but normally only comes through curl. Why can this be so?

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