Help API price token

const getCoin = async () => {
  try {
    
    const token = await getToken();

    const coin = await axios({
      url: 'https://us.api.blizzard.com/data/wow/token/index',
      method: 'get',
      params: {
        locale: 'en_US',
        namespace: 'dynamic-us',
        access_token: token,
      },
      headers: {
        'Accept':'application/json',
        'Content-Type': 'application/x-www-form-urlencoded',
      },
    })
    return coin?.data?.price
  }
  catch (error){
    console.log('Error',error)
  }
}

response

{
  "_links": {
    "self": {
      "href": "https://us.api.blizzard.com/data/wow/token/?namespace=dynamic-us"
    }
  },
  "last_updated_timestamp": 1669954181000,
  "price": 1760100000
}

My return sometimes looks like this

  data: '\x1F�\b\x00\x00\x00\x00\x00\x00�\x14�A\n' +
    '� \x10\x00���=�.DO�M7�L�U$ÿW��\x07V��)�\x1F\x10����\x13�R�h�*��S�w�S���\x0B-\x15�\x16\x1B�xr�%�Œ��l���LU`�\x17\x00\x00���Q�I,.�/-\x00�OM�/�\x04�*I�-P�243��451�0400�Q*(�LN\x05���\x19�\x04\f\fj\x01\x00\x00\x00��\x03\x00�\tt\x14�\x00\x00\x00'

WHY ?

You’re getting a gzipped response which axios isn’t unzipping.

1 Like