// 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]"
});
But: