-
-
Notifications
You must be signed in to change notification settings - Fork 11.6k
responseType: 'text' return Json Object #907
Copy link
Copy link
Closed
Description
// test.txt --> adsasdsa55
axios.get('./test.txt', { responseType: 'json' }).then(response => {
console.log( response.data );
// output `null`, illegal, awesome!
});
// test.json --> [1233]
axios.get('./test.json', { responseType: 'json' }).then(response => {
console.log( response.data );
// output Array(1233), ok!
});But:
// test.txt --> [false,5]
axios.get('./test.txt', { responseType: 'text' }).then(response => {
console.log( typeof response.data );
// output `object` , not `string`, why?
console.log( response.data );
// output Array(false, 5), not "[false,5]"
});- axios version: v0.16.1
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels