Comparing version 5.4.0 to 5.5.1
@@ -103,3 +103,3 @@ | ||
clearTimeout(timeoutId); | ||
self.emit('response', err, req, res, start); | ||
self.emit('response', err, req, res, start, uri); | ||
@@ -106,0 +106,0 @@ if (callback) { |
{ | ||
"name": "wreck", | ||
"description": "HTTP Client Utilities", | ||
"version": "5.4.0", | ||
"version": "5.5.1", | ||
"repository": "git://github.com/hapijs/wreck", | ||
@@ -6,0 +6,0 @@ "main": "index", |
@@ -44,3 +44,3 @@ ![wreck Logo](https://raw.github.com/hapijs/wreck/master/images/wreck.png) | ||
/* handle err if it exists, in which case res will be undefined */ | ||
// buffer the response stream | ||
@@ -189,3 +189,3 @@ Wreck.read(res, null, function (err, body) { | ||
`httpsAllowUnauthorized` which is an `https` agent with `rejectUnauthorized` set to true. All agents have `maxSockets` | ||
configured to `Infinity`. They are each instances of the node.js | ||
configured to `Infinity`. They are each instances of the node.js | ||
[Agent](http://nodejs.org/api/http.html#http_class_http_agent) and expose the standard properties. | ||
@@ -207,6 +207,14 @@ | ||
The response event is always emitted for any request that *wreck* makes. The handler should accept the following | ||
arguments `(error, request, response, start)`. This event is useful for logging all requests that go through *wreck*. | ||
The error and response arguments can be undefined depending on if an error occurs. Please be aware that if multiple | ||
modules are depending on the same cached *wreck* module that this event can fire for each request made across all | ||
arguments `(error, request, response, start, uri)` where: | ||
- `error` - a Boom error | ||
- `request` - the raw `ClientHttp` request object | ||
- `response` - the raw `IncomingMessage` response object | ||
- `start` - the time that the request was initiated | ||
- `uri` - the result of `Url.parse(uri)`. This will provide information about the resource requested. Also includes | ||
the headers and method. | ||
This event is useful for logging all requests that go through *wreck*. | ||
The error and response arguments can be undefined depending on if an error occurs. Please be aware that if multiple | ||
modules are depending on the same cached *wreck* module that this event can fire for each request made across all | ||
modules. The start argument is the timestamp when the request was started. This can be useful for determining how long | ||
it takes *wreck* to get a response back and processed. |
@@ -1527,4 +1527,10 @@ // Load modules | ||
Wreck.once('response', function (err, req, res, start) { | ||
var server = Http.createServer(function (req, res) { | ||
res.writeHead(200); | ||
res.end('ok'); | ||
}); | ||
Wreck.once('response', function (err, req, res, start, uri) { | ||
expect(err).to.not.exist(); | ||
@@ -1534,11 +1540,7 @@ expect(req).to.exist(); | ||
expect(typeof start).to.equal('number'); | ||
expect(uri.href).to.equal('http://localhost:' + server.address().port + '/'); | ||
done(); | ||
}); | ||
var server = Http.createServer(function (req, res) { | ||
res.writeHead(200); | ||
res.end('ok'); | ||
}); | ||
server.listen(0, function () { | ||
@@ -1545,0 +1547,0 @@ |
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
108770
1499
218