Reputation: 11
I am writing a Node.js app to get info from a server.
A successful HTTP GET returned a response that seems to have compressed data.
Below is the response header:
AxiosHeaders {
date: 'Tue, 13 Dec 2022 02:35:30 GMT',
server: 'Restlet-Framework/2.4.2',
'strict-transport-security': 'max-age=31536000;includeSubDomains',
'content-type': 'application/json;charset=utf-8',
'accept-ranges': 'bytes',
vary: 'Accept-Charset,Accept-Encoding,Accept-Language,Accept',
'x-mag': 'FF544D89FCC0751E;8315c9c1;481618;usrLkup->0;usrBase->0;getPRBefFind->0;getPRBefFind->0;PRAfterFind->0;D-IDM_REST_UMHS_IDV;usrLkup->0;usrBase->0;SendSoapStart->0;SendSoapExit->289;NRLEnd->289;Oauth-IDM_REST_UMHS_IDV;default;SH;FF1End->289;SendSoapStart->289;SendSoapExit->510;EvalII->510;AH;FP2->510;WS=415c128d;default;FP4->819;',
'set-cookie': [
'ZNPCQ003-32353400=415c128d; Path=/o-umhsIDV; Domain=.med.umich.edu'
],
via: '1.1 ...server-name... (Access Gateway-ag-FF544D89FCC0751E-481618)',
'keep-alive': 'timeout=300, max=100',
connection: 'Keep-Alive',
'transfer-encoding': 'chunked'
}
The data in the response is 1192 bytes of:
��"�����w$;����><(��x�
It seems that the response header is missing a Content-Encoding
. Does that cause Axios to not process the data properly?
Thank you for any thoughts / comments.
The result is expected to be JSON.
I tried to use zlib to decompress the data. But various methods (gunzip, unzip. deflate, ...) all resulted in error with the data.
Upvotes: 0
Views: 44
Reputation: 11
@[Bench Vue] is right. I updated the Axios package to 1.2.1 with a npm i axios
. My app started working. Many thanks!
Upvotes: 1