Я пытаюсь настроить запрос в Ax ios. Запрос отлично работает с cUrl:
curl 'https://www.nseindia.com/api/quote-equity?symbol=COALINDIA' -H 'User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/80.0.3987.87 Safari/537.36' -H 'Cookie: any' --compressed
, однако я не могу заставить его работать с Ax ios (на том же сервере). Вот мой запрос в узле:
var axiosOptions = {
method: 'GET',
url: 'https://www.nseindia.com/api/quote-equity?symbol=COALINDIA',
responseType: 'arraybuffer',
timeout: 30000,
headers: {
'User-Agent': 'Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/78.0.3904.108 Safari/537.36',
Cookie: 'any'
}
}
await axios(axiosOptions)
Он ожидает истечения времени ожидания для отправки следующего исключения
Error: timeout of 30000ms exceeded
at createError (/var/www/api/node_modules/axios/lib/core/createError.js:16:15)
at Timeout.handleRequestTimeout [as _onTimeout] (/var/www/api/node_modules/axios/lib/adapters/http.js:217:16)
at listOnTimeout (timers.js:327:15)
at processTimers (timers.js:271:5)
config:
{ adapter: [Function: httpAdapter],
transformRequest: { '0': [Function: transformRequest] },
transformResponse: { '0': [Function: transformResponse] },
timeout: 30000,
xsrfCookieName: 'XSRF-TOKEN',
xsrfHeaderName: 'X-XSRF-TOKEN',
maxContentLength: -1,
validateStatus: [Function: validateStatus],
headers:
{ Accept: 'application/json, text/plain, */*',
'User-Agent':
'Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/80.0.3987.116 Safari/537.36',
Cookie: 'any' },
method: 'get',
url: 'https://www.nseindia.com/api/quote-equity?symbol=COALINDIA',
responseType: 'arraybuffer',
data: undefined },
code: 'ECONNABORTED',
request:
Writable {
_writableState:
WritableState {
objectMode: false,
highWaterMark: 16384,
...
_header:
'GET /api/quote-equity?symbol=COALINDIA HTTP/1.1\r\nAccept: application/json, text/plain, */*\r\nUser-Agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/80.0.3987.116 Safari/537.36\r\nCookie: any\r\nHost: www.nseindia.com\r\nConnection: close\r\n\r\n',
_onPendingData: [Function: noopPendingOutput],
agent: [Agent],
socketPath: undefined,
timeout: undefined,
method: 'GET',
path: '/api/quote-equity?symbol=COALINDIA',
_ended: false,
res: null,
...
Что я делаю неправильно в Ax ios?