I'm trying to make a GET request to an api I have that has a JSON Web Token for authentication and takes form-encoded data. It keeps failing with "Network Error" but when I run the same api in cURL, the proper data is returned. Below is my code usign the Axios library:
const token = "xxxxx"; axios.get('https://xxxxxxx.com/route', { headers: { 'Authorization': token, 'Content-Type': 'application/x-www-form-urlencoded' }, data: {} }).then(response => { console.log(response.data); }) .catch((error) => { console.log(error.message); }); Working cURL request:
curl -X GET \ https://xxxxxxxx.com/route \ -H 'authorization: xxxxxx' \ -H 'cache-control: no-cache' \ -H 'content-type: application/x-www-form-urlencoded' Any help is appreciated!