Comparing version 0.3.0 to 0.3.1
{ | ||
"name": "hubkit", | ||
"version": "0.3.0", | ||
"version": "0.3.1", | ||
"homepage": "https://github.com/pkaminski/hubkit", | ||
@@ -5,0 +5,0 @@ "authors": [ |
@@ -151,2 +151,11 @@ if (typeof require !== 'undefined') { | ||
} | ||
// If the request failed due to CORS, it may be because it was both preflighted and | ||
// redirected. Attempt to recover by reissuing it as a simple request without preflight, | ||
// which requires getting rid of all extraneous headers. | ||
if (cacheable && | ||
/Origin is not allowed by Access-Control-Allow-Origin/.test(error.originalMessage)) { | ||
cacheable = false; | ||
retry(); | ||
return; | ||
} | ||
var value, retryDelay; | ||
@@ -340,3 +349,10 @@ if (options.onError) value = options.onError(error); | ||
if (req.agent) req.agent(options.agent); | ||
if (options.token) req.set('Authorization', 'token ' + options.token); | ||
if (options.token) { | ||
if (typeof module === 'undefined' && ( | ||
options.method === 'GET' || options.method === 'HEAD')) { | ||
req.query({'access_token': options.token}); | ||
} else { | ||
req.set('Authorization', 'token ' + options.token); | ||
} | ||
} | ||
if (!options.token && options.username && options.password) { | ||
@@ -352,5 +368,8 @@ req.auth(options.username, options.password); | ||
// Work around Firefox bug that forces caching. We can't use Cache-Control because it's not | ||
// allowed by Github's cross-domain request headers. | ||
// allowed by Github's cross-domain request headers, and because we want to keep our requests | ||
// simple to avoid CORS preflight whenever possible. | ||
// https://bugzilla.mozilla.org/show_bug.cgi?id=428916 | ||
req.set('If-Modified-Since', 'Sat, 1 Jan 2000 00:00:00 GMT'); | ||
if (typeof module === 'undefined') { | ||
req.query({'_nocache': Math.round(Math.random() * 1000000)}); | ||
} | ||
} | ||
@@ -357,0 +376,0 @@ |
{ | ||
"name": "hubkit", | ||
"version": "0.3.0", | ||
"version": "0.3.1", | ||
"description": "GitHub API library for JavaScript, promise-based, for both NodeJS and the browser", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
26544
429