Skip to content

Commit 3945773

Browse files
authored
fix(types): allow Promise<void> return type for proxyRes callback (#1190)
The proxyRes callback type only allowed void return type, but when using responseInterceptor, the handler is async and returns Promise<void>. This fix updates the type to allow both void and Promise<void> return types, matching the actual behavior of responseInterceptor. Fixes #1151
1 parent 87107bf commit 3945773

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

src/types.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ export interface OnProxyEvent<
4848
options: ProxyServerOptions,
4949
head: any,
5050
) => void;
51-
proxyRes?: (proxyRes: TReq, req: TReq, res: TRes) => void;
51+
proxyRes?: (proxyRes: TReq, req: TReq, res: TRes) => void | Promise<void>;
5252
open?: (proxySocket: net.Socket) => void;
5353
close?: (proxyRes: TReq, proxySocket: net.Socket, proxyHead: any) => void;
5454
start?: (req: TReq, res: TRes, target: string | Partial<URL>) => void;

0 commit comments

Comments
 (0)