Skip to content

Commit

Permalink
using url.resolve instead of path.join
Browse files Browse the repository at this point in the history
  • Loading branch information
dominicbarnes committed Jul 10, 2015
1 parent 17dd652 commit 0841cd4
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions lib/github.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

var debug = require('debug')('duo:gh-resolve:github');
var request = require('co-request');
var path = require('path');
var url = require('url');


/**
Expand Down Expand Up @@ -53,18 +53,18 @@ exports.branch = function* (token, options) {
*/

function* get(token, parts, attempts) {
var url = 'https://api.github.com/' + path.join.apply(path, parts);
debug('--> GET %s', url);
var uri = url.resolve('https://api.github.com/', parts.join('/'));
debug('--> GET %s', uri);

var res = yield request({
url: url,
url: uri,
qs: { access_token: token },
headers: { 'User-Agent': 'duo:gh-resolve' },
followRedirects: true,
json: true
});

debug('<-- %s %s', res.statusCode, url);
debug('<-- %s %s', res.statusCode, uri);
rateLimit(res.headers);

if (isError(res.statusCode)) {
Expand Down

0 comments on commit 0841cd4

Please sign in to comment.