gpt4 book ai didi

javascript - 我无法将请求正文添加到我的输出中

转载 作者:行者123 更新时间:2023-11-30 14:28:19 25 4
gpt4 key购买 nike

<分区>

我从 node.js 开始,我正在尝试做一个简单的请求。我正在使用“请求”:“^2.87.0”

       output = "Hello ";
const h = {'content-type': 'application/json'};
const u = weburl;
const b = JSON.stringify({
"username" : user,
"password" : psw
});
request.post({
headers : h,
url : u,
body : b
},function(error,response,body){
if (error)
output+= error;
else {
var jsonbody = JSON.stringify(body); //jsonbody = "\"token\""
jsonbody = jsonbody.substr(3,jsonbody.length-4); // jsonbody = token
console.log(jsonbody);
output += jsonbody;
}
});
send_message(output);

token 显示在控制台中,但输出是“Hello”而不是“Hello token”

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com