wreck
Advanced tools
Comparing version 6.2.0 to 6.3.0
@@ -20,3 +20,3 @@ | ||
jsonRegex: /^application\/[a-z.+-]*json$/, | ||
shallowOptions: ['agent', 'payload', 'downstreamRes', 'redirected'] | ||
shallowOptions: ['agent', 'payload', 'downstreamRes', 'beforeRedirect', 'redirected'] | ||
}; | ||
@@ -80,2 +80,5 @@ | ||
Hoek.assert(options.beforeRedirect === undefined || options.beforeRedirect === null || typeof options.beforeRedirect === 'function', | ||
'options.beforeRedirect must be a function'); | ||
Hoek.assert(options.redirected === undefined || options.redirected === null || typeof options.redirected === 'function', | ||
@@ -193,2 +196,6 @@ 'options.redirected must be a function'); | ||
if (options.beforeRedirect) { | ||
options.beforeRedirect(redirectMethod, statusCode, location, redirectOptions); | ||
} | ||
var redirectReq = self.request(redirectMethod, location, redirectOptions, finish, _trace); | ||
@@ -195,0 +202,0 @@ |
{ | ||
"name": "wreck", | ||
"description": "HTTP Client Utilities", | ||
"version": "6.2.0", | ||
"version": "6.3.0", | ||
"repository": "git://github.com/hapijs/wreck", | ||
@@ -13,3 +13,3 @@ "main": "lib/index", | ||
"engines": { | ||
"node": ">=0.10.30" | ||
"node": ">=0.10.40" | ||
}, | ||
@@ -16,0 +16,0 @@ "dependencies": { |
@@ -45,2 +45,3 @@ ![wreck Logo](https://raw.github.com/hapijs/wreck/master/images/wreck.png) | ||
redirects: 3, | ||
beforeRedirect: function (redirectMethod, statusCode, location, redirectOptions) {}, | ||
redirected: function (statusCode, location, req) {}, | ||
@@ -87,2 +88,7 @@ timeout: 1000, // 1 second, default: unlimited | ||
- `redirects` - The maximum number of redirects to follow. | ||
- `beforeRedirect` - A callback function that is called before a redirect is triggered, using the signature function (redirectMethod, statusCode, location, redirectOptions) where: | ||
- `redirectMethod` - A string specifying the redirect method. | ||
- `statusCode` - HTTP status code of the response that triggered the redirect. | ||
- `location` - The redirect location string. | ||
- `redirectOptions` - Options that will be applied to the redirect request. | ||
- `redirected` - A callback function that is called when a redirect was triggered, using the signature `function (statusCode, location, req)` where: | ||
@@ -89,0 +95,0 @@ - `statusCode` - HTTP status code of the response that triggered the redirect. |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
132722
1856
260