Skip to content

Commit

Permalink
util/github: set User-Agent per API requirements
Browse files Browse the repository at this point in the history
If this header is not set, the request is blocked.
See for more: https://developer.github.com/v3/#user-agent-required

Fixes fat#18.
  • Loading branch information
parkr committed Dec 16, 2015
1 parent e7a0f30 commit 83e2298
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion lib/util/github.js
Expand Up @@ -9,6 +9,8 @@
var request = require('request');
var querystring = require('querystring');

var haunt = require('../../package.json');

var github = function (path, options, callback) {

var username = github.username;
Expand Down Expand Up @@ -46,6 +48,7 @@ var github = function (path, options, callback) {
req.method = method;
req.headers = {
'Host': 'api.github.com',
'User-Agent': 'haunt/v' + haunt.version,
'Authorization': 'Basic ' + new Buffer(username + ':' + password).toString('base64')
}

Expand Down Expand Up @@ -281,4 +284,4 @@ function commentOnFile(user, repo, number) {
method: 'POST'
}, callback);
}
}
}

0 comments on commit 83e2298

Please sign in to comment.