refactor: cleanup default worker options handling
[e-mobility-charging-stations-simulator.git] / src / charging-station / ui-server / UIHttpServer.ts
index 32b82e9c995a45c22fb8d1828c5bb16215056314..ee12b3f4de996ed3a8f86b2a4db97949e9ebaf4e 100644 (file)
@@ -116,9 +116,9 @@ export class UIHttpServer extends AbstractUIServer {
         );
       });
       if (req.method === HttpMethods.POST) {
-        const bodyBuffer = [];
+        const bodyBuffer: Uint8Array[] = [];
         req
-          .on('data', (chunk) => {
+          .on('data', (chunk: Uint8Array) => {
             bodyBuffer.push(chunk);
           })
           .on('end', () => {
@@ -132,9 +132,9 @@ export class UIHttpServer extends AbstractUIServer {
                   body ?? Constants.EMPTY_FREEZED_OBJECT,
                 ),
               )
-              .then((protocolResponse: ProtocolResponse) => {
+              .then((protocolResponse?: ProtocolResponse) => {
                 if (!isNullOrUndefined(protocolResponse)) {
-                  this.sendResponse(protocolResponse);
+                  this.sendResponse(protocolResponse!);
                 }
               })
               .catch(Constants.EMPTY_FUNCTION);