Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions test/e2e/http-proxy-middleware.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,11 @@ describe('E2E http-proxy-middleware', () => {

it('should reject CRLF multipart injection when fixRequestBody serializes multipart', async () => {
const targetSpy = vi.fn();
const loggerSpy: Logger = {
info: vi.fn(),
warn: vi.fn(),
error: vi.fn(),
};

agent = request(
createApp(
Expand All @@ -153,6 +158,7 @@ describe('E2E http-proxy-middleware', () => {
fixRequestBody(proxyReq, req);
},
},
logger: loggerSpy,
}),
),
);
Expand All @@ -173,6 +179,13 @@ describe('E2E http-proxy-middleware', () => {

expect(response.text).toContain('Error occurred while trying to proxy');
expect(targetSpy).toHaveBeenCalledTimes(0);
expect(loggerSpy.error).toHaveBeenCalledWith(
'[HPM] Error occurred while proxying request %s to %s [%s] (%s)',
expect.anything(),
expect.anything(),
'HPM_ERR_INVALID_MULTIPART_FIELD_VALUE',
'https://nodejs.org/api/errors.html#errors_common_system_errors',
);
Comment thread
coderabbitai[bot] marked this conversation as resolved.
});
});

Expand Down
Loading