将以下curl命令转换为axios [英] Converting following curl command to axios

查看:125
本文介绍了将以下curl命令转换为axios的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

以下curl命令的axios等效项是什么?

What is the axios equivalent for the following curl command?

curl -G https://octopart.com/api/v3/parts/match    
-d queries='[{"mpn":"SN74S74N"}]'    
-d apikey=KEY      
-d limit=0 
-d include[]=specs 
-d show[]=specs

预先感谢

推荐答案

此代码将为您提供帮助.

This code will help you.

axios.post('https://octopart.com/api/v3/parts/match ',
 {queries: [{mpn:"SN74S74N"}], apikey: "KEY", limit: 0, include:["specs"], show: ["specs"]}
)
.then( response => {
     console.log("Response is: ", response);
})
.catch( error => {
     console.log("Error is :", error);
});

这篇关于将以下curl命令转换为axios的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆