From 4b53123858585ef06dc1c2273911554f431b5324 Mon Sep 17 00:00:00 2001 From: maple Date: Tue, 17 Aug 2021 17:03:29 +0800 Subject: [PATCH 1/2] Fix a typo in _handlers.ts --- src/_handlers.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/_handlers.ts b/src/_handlers.ts index e44e5dc7..6cdefd79 100644 --- a/src/_handlers.ts +++ b/src/_handlers.ts @@ -79,7 +79,7 @@ function defaultErrorHandler(err, req: express.Request, res: express.Response) { } } - res.end(`Error occured while trying to proxy: ${host}${req.url}`); + res.end(`Error occurred while trying to proxy: ${host}${req.url}`); } function logClose(req, socket, head) { From 7d726d54cea2762cb69c0165cd627b63cd13621e Mon Sep 17 00:00:00 2001 From: maple Date: Wed, 18 Aug 2021 02:42:55 +0800 Subject: [PATCH 2/2] Fix a typo in handlers.spec.ts --- test/unit/handlers.spec.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test/unit/handlers.spec.ts b/test/unit/handlers.spec.ts index e8d5e195..22a8cfc1 100644 --- a/test/unit/handlers.spec.ts +++ b/test/unit/handlers.spec.ts @@ -119,7 +119,7 @@ describe('default proxy error handler', () => { it('should end the response and return error message', () => { proxyError(mockError, mockReq, mockRes, proxyOptions); - expect(errorMessage).toBe('Error occured while trying to proxy: localhost:3000/api'); + expect(errorMessage).toBe('Error occurred while trying to proxy: localhost:3000/api'); }); it('should not set the http status code to: 500 if headers have already been sent', () => { @@ -131,7 +131,7 @@ describe('default proxy error handler', () => { it('should end the response and return error message', () => { mockRes.headersSent = true; proxyError(mockError, mockReq, mockRes, proxyOptions); - expect(errorMessage).toBe('Error occured while trying to proxy: localhost:3000/api'); + expect(errorMessage).toBe('Error occurred while trying to proxy: localhost:3000/api'); }); it('should re-throw error from http-proxy when target is missing', () => {