Reactjs 模拟邮递员请求进入Axios?
我正在尝试构建我的Reactjs 模拟邮递员请求进入Axios?,reactjs,api,react-native,axios,postman,Reactjs,Api,React Native,Axios,Postman,我正在尝试构建我的axios,以便能够模拟邮递员请求,但失败了。请帮忙看看 const ax = axios.create({ timeout: 30000, headers: { 'content-type': 'application/x-www-form-urlencoded' } }); // Attempt register operation ax.post('https://url/5bc9ff9628d79b6d274165da/update.json',
axios
,以便能够模拟邮递员请求,但失败了。请帮忙看看
const ax = axios.create({
timeout: 30000,
headers: {
'content-type': 'application/x-www-form-urlencoded'
}
});
// Attempt register operation
ax.post('https://url/5bc9ff9628d79b6d274165da/update.json', {
body: JSON.stringify({
json: JSON.stringify({ "stat": "Delivered" })
})
})
.then(({ data }) => {
console.log('DEBUG::success!!! data::', data);
})
.catch((err) => {
console.log('DEBUG::err', err);
});
您可以使用Postman中的代码生成功能 点击代码(保存按钮下方)>搜索'Axios'>NodeJS-Axios
用于在Postman中生成代码的文档:是否可以将标题屏幕截图显示为well@Goldy字体请看一看。剩下的两个密钥将被隐藏,因为它是一些秘密密钥,我认为在这个问题上不需要它。我不知道有这么大的功能!谢谢你,伙计!