HTTP GET请求时如何传递参数?


httpRequest.request("EXAMPLE_URL",
{
method: http.RequestMethod.GET,
header: {
'Content-Type': 'application/json'
},
readTimeout: 60000,
connectTimeout: 60000
}, (err, data) => {
if (!err) {
console.info('Result:' + data.result);
console.info('code:' + data.responseCode);
console.info('header:' + JSON.stringify(data.header));
console.info('cookies:' + data.cookies); // 8+
console.info('header.Content-Type:' + data.header['Content-Type']);
console.info('header.Status-Line:' + data.header['Status-Line']);
} else {
console.info('error:' + JSON.stringify(err));
}
});
  • 1.
  • 2.
  • 3.
  • 4.
  • 5.
  • 6.
  • 7.
  • 8.
  • 9.
  • 10.
  • 11.
  • 12.
  • 13.
  • 14.
  • 15.
  • 16.
  • 17.
  • 18.
  • 19.
  • 20.
鸿蒙
DevEco Studio
UI
2023-02-02 15:17:15
4163浏览
收藏 0
回答 1
回答 1
按赞同
/
按时间
ohohy
1
分享
微博
QQ
微信
回复
2023-02-03 13:11:26


相关问题
HarmonyOS http post请求参数传递
1113浏览 • 1回复 待解决
关于JS http请求参数传递问题
8424浏览 • 2回复 待解决
HarmonyOS http get请求不到内容
1154浏览 • 1回复 待解决
HarmonyOS rcp请求如何传递参数
827浏览 • 1回复 待解决
HarmonyOS http 请求 post 参数问题
2395浏览 • 1回复 待解决
HarmonyOS HTTP-post请求接收不到参数
1045浏览 • 1回复 待解决
网络请求-GET请求传参
1523浏览 • 1回复 待解决
HarmonyOS RCP GET请求、POST请求如何传参
1051浏览 • 1回复 待解决
http请求中能否不设置Content-Type参数
3044浏览 • 1回复 待解决