http2-proxy
Advanced tools
Comparing version 5.0.4 to 5.0.5
{ | ||
"name": "http2-proxy", | ||
"version": "5.0.4", | ||
"version": "5.0.5", | ||
"scripts": { | ||
@@ -5,0 +5,0 @@ "dev": "nodemon --inspect=9308 src", |
@@ -16,3 +16,3 @@ # node-http2-proxy | ||
```sh | ||
```bash | ||
$ npm install http2-proxy | ||
@@ -137,3 +137,3 @@ ``` | ||
### web (req, res, options, [callback]) | ||
### `async web (req, res, options, [callback])` | ||
@@ -147,3 +147,3 @@ - `req`: [`http.IncomingMessage`](https://nodejs.org/api/http.html#http_class_http_incomingmessage) or [`http2.Http2ServerRequest`](https://nodejs.org/api/http2.html#http2_class_http2_http2serverrequest). | ||
### ws (req, socket, head, options, [callback]) | ||
### `async ws (req, socket, head, options, [callback])` | ||
@@ -154,24 +154,24 @@ - `req`: [`http.IncomingMessage`](https://nodejs.org/api/http.html#http_class_http_incomingmessage). | ||
- `options`: See [Options](#options). | ||
- `callback(err, req, socket, head)`: Called on completion or error. Optional. | ||
- `async allback(err, req, socket, head)`: Called on completion or error. Optional. | ||
See [`upgrade`](https://nodejs.org/api/http.html#http_event_upgrade) | ||
### Options | ||
### `options` | ||
- `hostname`: Proxy [`http.request(options)`](https://nodejs.org/api/http.html#http_http_request_options_callback) target hostname. | ||
- `port`: Proxy [`http.request(options)`](https://nodejs.org/api/http.html#http_http_request_options_callback) target port. | ||
- `protocol`: 'string' agent protocol ('http' or 'https'). Defaults to 'http'. | ||
- `path`: 'string' target pathname. Defaults to `req.originalUrl || req.url`. | ||
- `proxyTimeout`: Proxy [`http.request(options)`](https://nodejs.org/api/http.html#http_http_request_options_callback) timeout. | ||
- `proxyName`: Proxy name used for **Via** header. | ||
- `timeout`: [`http.IncomingMessage`](https://nodejs.org/api/http.html#http_class_http_incomingmessage) or [`http2.Http2ServerRequest`](https://nodejs.org/api/http2.html#http2_class_http2_http2serverrequest) timeout. | ||
- `onReq(req, options, callback)`: Called before proxy request. If returning a truthy value it will be used as the request. | ||
- `req`: [`http.IncomingMessage`](https://nodejs.org/api/http.html#http_class_http_incomingmessage) or [`http2.Http2ServerRequest`](https://nodejs.org/api/http2.html#http2_class_http2_http2serverrequest) | ||
- `options`: Options passed to [`http.request(options)`](https://nodejs.org/api/http.html#http_http_request_options_callback). | ||
- `callback(err)`: Called on completion or error. Optionally a promise can be returned. | ||
- `onRes(req, resOrSocket, proxyRes, callback)`: Called before proxy response. | ||
- `req`: [`http.IncomingMessage`](https://nodejs.org/api/http.html#http_class_http_incomingmessage) or [`http2.Http2ServerRequest`](https://nodejs.org/api/http2.html#http2_class_http2_http2serverrequest). | ||
- `resOrSocket`: For `web` [`http.ServerResponse`](https://nodejs.org/api/http.html#http_class_http_serverresponse) or [`http2.Http2ServerResponse`](https://nodejs.org/api/http2.html#http2_class_http2_http2serverresponse) and for `ws` [`net.Socket`](https://nodejs.org/api/net.html#net_class_net_socket). | ||
- `proxyRes`: [`http.ServerResponse`](https://nodejs.org/api/http.html#http_class_http_serverresponse). | ||
- `callback(err)`: Called on completion or error. Optionally a promise can be returned. | ||
- `hostname`: Proxy [`http.request(options)`](https://nodejs.org/api/http.html#http_http_request_options_callback) target hostname. | ||
- `port`: Proxy [`http.request(options)`](https://nodejs.org/api/http.html#http_http_request_options_callback) target port. | ||
- `protocol`: Agent protocol (`'http'` or `'https'`). Defaults to `'http'`. | ||
- `path`: Target pathname. Defaults to `req.originalUrl || req.url`. | ||
- `proxyTimeout`: Proxy [`http.request(options)`](https://nodejs.org/api/http.html#http_http_request_options_callback) timeout. | ||
- `proxyName`: Proxy name used for **Via** header. | ||
- `timeout`: [`http.IncomingMessage`](https://nodejs.org/api/http.html#http_class_http_incomingmessage) or [`http2.Http2ServerRequest`](https://nodejs.org/api/http2.html#http2_class_http2_http2serverrequest) timeout. | ||
- `async onReq(req, options, callback)`: Called before proxy request. If returning a truthy value it will be used as the request. | ||
- `req`: [`http.IncomingMessage`](https://nodejs.org/api/http.html#http_class_http_incomingmessage) or [`http2.Http2ServerRequest`](https://nodejs.org/api/http2.html#http2_class_http2_http2serverrequest) | ||
- `options`: Options passed to [`http.request(options)`](https://nodejs.org/api/http.html#http_http_request_options_callback). | ||
- `callback(err)`: Called on completion or error. Optional. | ||
- `async onRes(req, resOrSocket, proxyRes, callback)`: Called on proxy response. Writing of response must be done inside this method if provided. | ||
- `req`: [`http.IncomingMessage`](https://nodejs.org/api/http.html#http_class_http_incomingmessage) or [`http2.Http2ServerRequest`](https://nodejs.org/api/http2.html#http2_class_http2_http2serverrequest). | ||
- `resOrSocket`: For `web` [`http.ServerResponse`](https://nodejs.org/api/http.html#http_class_http_serverresponse) or [`http2.Http2ServerResponse`](https://nodejs.org/api/http2.html#http2_class_http2_http2serverresponse) and for `ws` [`net.Socket`](https://nodejs.org/api/net.html#net_class_net_socket). | ||
- `proxyRes`: [`http.ServerResponse`](https://nodejs.org/api/http.html#http_class_http_serverresponse). | ||
- `callback(err)`: Called on completion or error. Optional. | ||
@@ -178,0 +178,0 @@ ### License |
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
19321