From 1185579a331f3484e8ed7882203d2e58466635dd Mon Sep 17 00:00:00 2001 From: =?utf8?q?J=C3=A9r=C3=B4me=20Benoit?= Date: Mon, 20 Feb 2023 22:47:35 +0100 Subject: [PATCH] refactor(simulator): introduce HTTP methods enum MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Signed-off-by: Jérôme Benoit --- src/charging-station/ui-server/UIHttpServer.ts | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/charging-station/ui-server/UIHttpServer.ts b/src/charging-station/ui-server/UIHttpServer.ts index b52df572..186669ef 100644 --- a/src/charging-station/ui-server/UIHttpServer.ts +++ b/src/charging-station/ui-server/UIHttpServer.ts @@ -18,6 +18,13 @@ import { AbstractUIServer, UIServerUtils } from '../internal'; const moduleName = 'UIHttpServer'; +enum HttpMethods { + GET = 'GET', + PUT = 'PUT', + POST = 'POST', + PATCH = 'PATCH', +} + export class UIHttpServer extends AbstractUIServer { public constructor(protected readonly uiServerConfiguration: UIServerConfiguration) { super(uiServerConfiguration); @@ -100,7 +107,7 @@ export class UIHttpServer extends AbstractUIServer { error ); }); - if (req.method === 'POST') { + if (req.method === HttpMethods.POST) { const bodyBuffer = []; req .on('data', (chunk) => { -- 2.34.1