From: Jérôme Benoit Date: Mon, 20 Feb 2023 21:47:35 +0000 (+0100) Subject: refactor(simulator): introduce HTTP methods enum X-Git-Tag: v1.1.95~37 X-Git-Url: https://git.piment-noir.org/?a=commitdiff_plain;h=1185579a331f3484e8ed7882203d2e58466635dd;p=e-mobility-charging-stations-simulator.git refactor(simulator): introduce HTTP methods enum Signed-off-by: Jérôme Benoit --- 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) => {