axios请求配置可以设置响应类型
export type ResponseType = | 'arraybuffer' | 'blob' | 'document' | 'json' | 'text' | 'stream';2.默认响应类型
默认的响应类型和content-type有关,text/plain 类型解析为 string
const server = http.createServer((req, res) => {
res.setHeader('content-type','text/plain')
res.write('hello world')
res.end()
})
axios.get('http://localhost:3000').then(res => {
console.log(typeof res.data)
})
string
application/json会被解析为对象
const server = http.createServer((req, res) => {
res.setHeader('content-type','application/json')
res.write(JSON.stringify({a:1,b:'test'}))
res.end()
})
axios.get(


