我在我的节点项目中有这个功能,它应该为特定用户创建一个新的GitHub存储库:
exports.create_repo = function (repo) {
var options = {
host: "api.github.com",
path: "/user/repos?access_token=" + repo.accessToken,
method: "POST",
json: { name: repo.name },
headers: { "User-Agent": "github-app" }
};
var request = https.request(options, function(response){
var body = '';
response.on("data", function(chunk){ body+=chunk.toString("utf8"); });
response.on("end", function(){
var json = JSON.parse(body);
console.log(json);
});
});
request.end();
}
每次使用时,回复都是:
{ message: 'Not Found',
documentation_url: 'https://developer.github.com/v3' }
我做错了什么?