gaxios
gaxios copied to clipboard
`Content-Type` response header is ignored
Related to https://github.com/googleapis/google-api-nodejs-client/issues/1777.
We accept a responseType
as part of the request config that dictates what processing we do with the response body before returning it in res.data
. By default, we just assume json
if not told otherwise. The problem pops up when the content type is defined in a response header, and we just ignore it. When an application/gzip
content type comes back in a header, I'd argue we shouldn't try JSON.parse
-ing that by default :)
cc @bcoe
adding Accept parameter to header prevent adding json content type by gaxios.
like "Accept": "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,/;q=0.",