mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-08-16 15:00:26 +00:00
added userResHeaderDecorator
This commit is contained in:
@@ -16,5 +16,13 @@ proxy('www.google.com', {
|
||||
console.log(proxyReqOpts.headers, proxyReqOpts.method);
|
||||
console.log(srcReq.url, srcReq.cookies);
|
||||
return proxyReqOpts;
|
||||
},
|
||||
userResHeaderDecorator(headers, userReq, userRes, proxyReq, proxyRes) {
|
||||
console.log(userReq.url, userRes.statusCode);
|
||||
console.log(proxyReq.url, proxyRes.statusCode);
|
||||
if (headers["content-type"] === "image/png") {
|
||||
headers["x-custom-header"] = "additional-info";
|
||||
}
|
||||
return headers;
|
||||
}
|
||||
});
|
||||
|
||||
Vendored
+5
-2
@@ -1,15 +1,18 @@
|
||||
// Type definitions for express-http-proxy 1.5
|
||||
// Project: https://github.com/villadora/express-http-proxy#readme
|
||||
// Definitions by: ulrichb <https://github.com/ulrichb>
|
||||
// Definitions by: ulrichb <https://github.com/ulrichb>
|
||||
// Daniel Schopf <https://github.com/Danscho>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.2
|
||||
|
||||
import { RequestHandler, Request } from "express";
|
||||
import { RequestOptions } from "http";
|
||||
import { RequestOptions, IncomingHttpHeaders, OutgoingHttpHeaders } from "http";
|
||||
import { Response } from "express-serve-static-core";
|
||||
|
||||
interface ProxyOptions {
|
||||
proxyReqPathResolver?: (req: Request) => string;
|
||||
proxyReqOptDecorator?: (proxyReqOpts: RequestOptions, srcReq: Request) => RequestOptions;
|
||||
userResHeaderDecorator?: (headers: IncomingHttpHeaders, userReq: Request, userRes: Response, proxyReq: Request, proxyRes: Response) => OutgoingHttpHeaders;
|
||||
}
|
||||
|
||||
declare function proxy(host: string, options?: ProxyOptions): RequestHandler;
|
||||
|
||||
Reference in New Issue
Block a user