Skip to content

Commit

Permalink
Coveralls: use request().
Browse files Browse the repository at this point in the history
Should fix badges#180.
  • Loading branch information
espadrine committed May 21, 2014
1 parent 8f85150 commit df63fee
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions server.js
Original file line number Diff line number Diff line change
Expand Up @@ -568,12 +568,16 @@ cache(function(data, match, sendBadge) {
var userRepo = match[1]; // eg, `jekyll/jekyll`.
var branch = match[2];
var format = match[3];
var apiUrl = 'http://badge.coveralls.io/repos/' + userRepo + '/badge.png';
var apiUrl = {
url: 'http://badge.coveralls.io/repos/' + userRepo + '/badge.png',
followRedirect: false,
method: 'HEAD'
};
if (branch) {
apiUrl += '?branch=' + branch;
apiUrl.url += '?branch=' + branch;
}
var badgeData = getBadgeData('coverage', data);
https.get(apiUrl, function(res) {
request(apiUrl, function(err, res) {
// We should get a 302. Look inside the Location header.
var buffer = res.headers.location;
if (!buffer) {
Expand Down

0 comments on commit df63fee

Please sign in to comment.