Comparing version 0.11.0-beta3 to 0.11.0-beta4
@@ -129,5 +129,3 @@ /* | ||
url_parts = require('url').parse(url), | ||
headers = {}, | ||
data = null, stream = null, | ||
textResponse = true, streamResponse = false; | ||
headers = {}; | ||
@@ -334,2 +332,16 @@ request.options.responseType || (request.options.responseType = 'text'); // 'text', 'stream', 'buffer' | ||
fermata.registerPlugin('timeout', function (transport, duration) { | ||
return function (request, callback) { | ||
var _req, watchdog = setTimeout(function () { | ||
watchdog = null; // signals logic below | ||
_req.abort(); | ||
}, duration || 60e3); | ||
return _req = transport(request, function (err, response) { | ||
if (!watchdog) err = Error("Request timed out."); | ||
else clearTimeout(watchdog); | ||
callback(err, response); | ||
}); | ||
}; | ||
}); | ||
fermata.registerPlugin('statusCheck', function (transport) { | ||
@@ -454,3 +466,3 @@ return function (request, callback) { | ||
this.base = baseURL; | ||
return transport.using('statusCheck').using('autoConvert', "application/json"); | ||
return transport.using('timeout').using('statusCheck').using('autoConvert', "application/json"); | ||
}); | ||
@@ -457,0 +469,0 @@ |
{ | ||
"name": "fermata", | ||
"version": "0.11.0-beta3", | ||
"version": "0.11.0-beta4", | ||
"homepage": "https://github.com/natevw/fermata", | ||
@@ -5,0 +5,0 @@ "repository":{"type":"git", "url":"https://github.com/natevw/fermata.git"}, |
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
48639
610