UI protocol: move Insomnia requests collection to its own directory
[e-mobility-charging-stations-simulator.git] / src / charging-station / ui-server / UIHttpServer.ts
index 289eda84781ad0d7686e88846a95e028cf45921f..ce52ed4b5dd432a9c9035bbdc0eac01c7a422e4f 100644 (file)
@@ -49,10 +49,11 @@ export default class UIHttpServer extends AbstractUIServer {
 
   public sendResponse(response: ProtocolResponse): void {
     const [uuid, payload] = response;
-    const statusCode = this.responseStatusToStatusCode(payload.status);
     if (this.responseHandlers.has(uuid) === true) {
       const { res } = this.responseHandlers.get(uuid);
-      res.writeHead(statusCode, { 'Content-Type': 'application/json' });
+      res.writeHead(this.responseStatusToStatusCode(payload.status), {
+        'Content-Type': 'application/json',
+      });
       res.write(JSON.stringify(payload));
       res.end();
       this.responseHandlers.delete(uuid);