Reputation: 3491
My issue is I believe I've constructed the request correctly, but I am getting [400 {"message":"Problems parsing JSON"}]
here is my code:
var xhr = Ti.Network.createHTTPClient({
onload : function() {
Ti.API.debug(this.responseText);
json = JSON.parse(this.responseText);
callback(json);
},
onerror : function(e) {
alert('error!');
Ti.API.info(e.error + " " + this.status + " " + this.responseText);
}
});
xhr.validatesSecureCertificate = true;
xhr.open("POST", "https://api.github.com/authorizations");
xhr.setTimeout(10000);
authstr = 'Basic ' + Titanium.Utils.base64encode(User.username + ':' + User.password);
xhr.setRequestHeader('Authorization', authstr);
xhr.send({username: User.username, password: User.password});
Upvotes: 0
Views: 955
Reputation: 3491
I simply missed the JSON.stringify method.... on my body :P. Thanks!
Upvotes: 1