我必须在bitbucket中创建问题,我使用curl作为:
curl --user {accountname}:{password} https://bitbucket.org/api/1.0/repositories/{accountname}/{repo_slug}/issues/ --data "title=some title"
但我无法弄清楚如何在Meteor.http.post中发送请求,就像我将其作为
传递一样 Meteor.http.post(https://bitbucket.org/api/1.0/repositories/{accountname}/{repo_slug}/issues/, {auth: {accountname}:{password}, data: "title=some title"}, function(error,result){
console.log(result);
});
我收到错误
Error: failed [400] <ul class="errorlist"><li>title<ul class="errorlist"><li>This field is required.</li></ul></li></ul>
请指出正确的方向,如何以流星形式编写卷曲代码。
答案 0 :(得分:0)
尝试通话:
Meteor.http.post(https://bitbucket.org/.../,{auth: {accountname}:{password},
data: {title: "some title"}, function(error,result){
console.log(result);
});
我认为您设置data
字段不正确。
答案 1 :(得分:0)
也许它应该是
Meteor.http.post('https://bitbucket.org/api/1.0/repositories/{accountname}/{repo_slug}/issues/', {auth: {accountname}:{password}, data: "title=some title"}, function(error,result){
console.log(result);
});