mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-10-03 14:27:04 +00:00
Add typing for proxyReqOptDecorator option
This commit is contained in:
@@ -10,3 +10,11 @@ proxy('www.google.com', {});
|
||||
proxy('www.google.com', {
|
||||
proxyReqPathResolver: (req) => req.url,
|
||||
});
|
||||
|
||||
proxy('www.google.com', {
|
||||
proxyReqOptDecorator(proxyReqOpts, srcReq) {
|
||||
console.log(proxyReqOpts.headers, proxyReqOpts.method);
|
||||
console.log(srcReq.url, srcReq.cookies);
|
||||
return proxyReqOpts;
|
||||
}
|
||||
});
|
||||
|
||||
Vendored
+2
@@ -5,9 +5,11 @@
|
||||
// TypeScript Version: 2.2
|
||||
|
||||
import { RequestHandler, Request } from "express";
|
||||
import { RequestOptions } from "http";
|
||||
|
||||
export interface ProxyOptions {
|
||||
proxyReqPathResolver?: (req: Request) => string;
|
||||
proxyReqOptDecorator?: (proxyReqOpts: RequestOptions, srcReq: Request) => RequestOptions;
|
||||
}
|
||||
|
||||
declare function proxy(host: string, options?: ProxyOptions): RequestHandler;
|
||||
|
||||
Reference in New Issue
Block a user