Creating a node CLI to create repos from CL, having an issue posting to github api. I'm using the request module to post to the github API.
request.post({
url: 'https://api.github.com/user/repos',
headers:{
'User-Agent': 'git CL - node',
'Content-type': 'application/json'
},
auth:{
username: '-username-',
password: '-password-'
},
form:{
name: "a-new-repo"
}
}, function(err, res, body){
console.log(body);
});
The error I'm getting is {"message":"Problems parsing JSON","documentation_url":"http://developer.github.com/v3"}
I've tried a ton of things, like
- Setting multipart data
- body instead of form data
- Setting the content-type
- Sending as JSON
Things I know are correct
- authentication --- I'm able to get a correct response if i do a GET req, its just the POST
- POST path and headers
Link for request-module
Link for github-api