gpt4 book ai didi

node.js - TypeError : Request path contains unescaped characters, 我该如何解决这个问题

转载 作者:IT老高 更新时间:2023-10-28 22:09:37 25 4
gpt4 key购买 nike

/*Making http request to the api (Git hub)
create request
parse responce
wrap in a function
*/
var https = require("https");

var username = 'lynndor';
//CREATING AN OBJECT
var options = {
host: 'api.github.com',
path: ' /users/'+ username +'/repos',
method: 'GET'
};

var request = https.request(options, function(responce){
var body = ''
responce.on("data", function(chunk){
body += chunk.toString('utf8')
});
responce.on("end", function(){
console.log("Body", body);
});
});
request.end();

Im trying to create a request to the git hub api, the aim is to get the list repository for the specified you, but i keep getting the above mentioned error, please help

最佳答案

对于其他情况可能会有所帮助

JavaScript encodeURI() Function

var uri = "my test.asp?name=ståle&car=saab";
var res = encodeURI(uri);

关于node.js - TypeError : Request path contains unescaped characters, 我该如何解决这个问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31024779/

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