返回的axios 中data是空的object
来源:5-11 获取响应数据 - 需求分析+实现

Yugc
2019-09-23
服务端返回的代码去看了老师的分支 确认没有问题…
router.post('/base/post', function(req, res) {
res.json(req.body)
})
debugger看了 const responseData = responseType && responseType !== 'text' ? request.response : request.responseText
这里拿到的responseData=就是为空…不知道哪个环节写错了…
写回答
2回答
-
建议你先看一下请求 header 和 body,有没有把数据传过去。
032019-09-23 -
Willy000
2020-05-24
我也发现了这个问题,是因为data被JSON.stringifyle ,没有过isPlainObject(data)这个判断,header是空的
00
相似问题