Is there any specific reason , why axios might reduce api response? such as the response is an array and there is 2 index data , but after axios process data only one remains. And if there is 1 index , it becomes an empty array. #axios #ReactNative
My code is given below ,
let response = await axios.get(
`$url`,
{
headers: {Authorization: authorize(token)},
},
);
console.log(response);
Top comments (7)
I don't think axios is causing this. The termimal itself is limited to displaying data, especially the VSCode integreated terminal. The whole response object in axios is very large, including the status codes and the others. Try getting only the data using
response.data
. If it doesn't work, I guess you should paste the whole response object here for us to see.i am quite sure that axios is causing this, cause i didn't use any seperate parser . And i can see the original data in network request. But when axios process the response in response.data , it gets reduced . And i didn't try fetch .
It will be better If you could share the code which takes the data from API using Axios so it's easy to understand what is happening.
updated the post
The code looks good to me. I don't see anything wrong here. something is wrong in the backend only from where you're taking the response.
Could you share an example of data in your network request & what you have in console ?