         // Check for appropriate HTTP method
         if (request->method() != HTTP_PATCH) {
           AsyncWebServerResponse *response =
-              request->beginResponse(405, PSTR(HTTP_MIMETYPE_JSON));
-          response->addHeader(PSTR(HTTP_HEADER_SERVER), SERVER_SIGNATURE);
-          response->addHeader(PSTR(HTTP_HEADER_ALLOW), PSTR("GET, PATCH"));
+              request->beginResponse(405, HTTP_MIMETYPE_JSON);
+          response->addHeader(HTTP_HEADER_SERVER, SERVER_SIGNATURE);
+          response->addHeader(HTTP_HEADER_ALLOW, "GET, PATCH");
           request->send(response);
         }
 

  server->addHandler(&ws);
  server->addHandler(&events);

  server->rewrite(PSTR("/"), HTTP_ROUTE_INDEX);

  // Send a file when /index is requested
  server->on(HTTP_ROUTE_INDEX, HTTP_GET, [](AsyncWebServerRequest *request) {
    AsyncWebServerResponse *response =
        request->beginResponse_P(200, HTTP_MIMETYPE_HTML, html_gz, html_gz_len);

    response->addHeader(PSTR("Content-Encoding"), PSTR("gzip"));
    response->addHeader(PSTR(HTTP_HEADER_SERVER), SERVER_SIGNATURE);

    request->send(response);
  });

bool authorizeAPI(AsyncWebServerRequest *request) {

  // Check if API Key is provided
  if (!request->hasHeader(HTTP_HEADER_APIKEY)) {
    DynamicJsonBuffer jsonBuffer;
    JsonObject &root = jsonBuffer.createObject();
    root["error"] = "400";
