I'm making a request to an external API. Everything works fine except response.data is returning something like this:
!�♥ ♠�� ▲,Zp→↔�<☼D#�.
�8�(N ☼hHs'>☼1�;�_↑►↕�♂↔^a�/�♀����D0�}♫ԥ>V►�↨�09�����4]♣ghn�q��◄�v�aޏ[�↕��G↑�i>my■�♂� sX�<♂�1ܛ~�O����V�8]↨-IT�_↑
nuxt 1.4.0@nuxtjs/axios ^5.1.1module.exports = {
modules: [
'@nuxtjs/axios',
],
axios: {
baseURL: 'https://www.example.com/api',
progress: true,
credentials: true
},
};
Turns out it has to do with the default value of the accept-encoding header. The server I'm making calls to is using the br value in the header.
$axios.setHeader('accept-encoding', '*'); or gzip or null fixes it.
EDIT: null works better than *. You don't get Refused to set unsafe header "accept-encoding" in Chrome.
Most helpful comment
Turns out it has to do with the default value of the
accept-encodingheader. The server I'm making calls to is using thebrvalue in the header.$axios.setHeader('accept-encoding', '*');orgzipornullfixes it.EDIT:
nullworks better than*. You don't getRefused to set unsafe header "accept-encoding"in Chrome.