Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/api/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Reactjs 模拟邮递员请求进入Axios?_Reactjs_Api_React Native_Axios_Postman - Fatal编程技术网

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字体请看一看。剩下的两个密钥将被隐藏,因为它是一些秘密密钥,我认为在这个问题上不需要它。我不知道有这么大的功能!谢谢你,伙计!