Comparing version 6.0.2 to 6.1.0
@@ -42,2 +42,3 @@ 'use strict'; | ||
onResponse: Joi.func(), | ||
onRequest: Joi.func(), | ||
agent: Joi.object(), | ||
@@ -154,3 +155,3 @@ ttl: Joi.string().valid('upstream').allow(null), | ||
Wreck.request(request.method, uri, options, (err, res) => { | ||
const req = Wreck.request(request.method, uri, options, (err, res) => { | ||
@@ -186,2 +187,7 @@ let ttl = null; | ||
}); | ||
// if there is an onRequest handler, pass it | ||
if (settings.onRequest) { | ||
settings.onRequest(req); | ||
} | ||
}); | ||
@@ -188,0 +194,0 @@ }; |
{ | ||
"name": "h2o2", | ||
"description": "Proxy handler plugin for hapi.js", | ||
"version": "6.0.2", | ||
"version": "6.1.0", | ||
"repository": "git://github.com/hapijs/h2o2", | ||
@@ -6,0 +6,0 @@ "main": "lib/index.js", |
@@ -9,3 +9,3 @@ # h2o2 | ||
Lead Maintainer - [Oscar A. Funes Martinez](https://github.com/osukaa) | ||
Lead Maintainer - [Sanjay Pandit](https://github.com/spanditcaa) | ||
@@ -65,2 +65,4 @@ ## Introduction | ||
* `headers` - optional object where each key is an HTTP request header and the value is the header content. | ||
* `onRequest` - a custom function which is passed the upstream request. Function signature is `function (req)` where: | ||
* `req` - the [wreck] (https://github.com/hapijs/wreck) request to the upstream server. | ||
* `onResponse` - a custom function for processing the response from the upstream service before sending to the client. Useful for custom error handling of responses from the proxied endpoint or other payload manipulation. Function signature is `function (err, res, request, reply, settings, ttl)` where: | ||
@@ -67,0 +69,0 @@ * `err` - internal or upstream error returned from attempting to contact the upstream proxy. |
Sorry, the diff of this file is too big to display
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
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
86626
1634
202
4