wreck
Advanced tools
Comparing version 5.3.0 to 5.4.0
@@ -86,2 +86,3 @@ | ||
var start = Date.now(); | ||
var req = client.request(uri); | ||
@@ -103,3 +104,3 @@ | ||
clearTimeout(timeoutId); | ||
self.emit('response', err, req, res, _trace); | ||
self.emit('response', err, req, res, start); | ||
@@ -106,0 +107,0 @@ if (callback) { |
{ | ||
"name": "wreck", | ||
"description": "HTTP Client Utilities", | ||
"version": "5.3.0", | ||
"version": "5.4.0", | ||
"repository": "git://github.com/hapijs/wreck", | ||
@@ -6,0 +6,0 @@ "main": "index", |
@@ -205,5 +205,6 @@ ![wreck Logo](https://raw.github.com/hapijs/wreck/master/images/wreck.png) | ||
The response event is always emitted for any request that *wreck* makes. The handler should accept the following | ||
arguments `(error, request, response)`. 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 | ||
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 | ||
modules. | ||
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,3 +1527,3 @@ // Load modules | ||
Wreck.once('response', function (err, req, res) { | ||
Wreck.once('response', function (err, req, res, start) { | ||
@@ -1533,2 +1533,3 @@ expect(err).to.not.exist(); | ||
expect(res).to.exist(); | ||
expect(typeof start).to.equal('number'); | ||
done(); | ||
@@ -1535,0 +1536,0 @@ }); |
108326
1498
210