Skip to content

feat: dedicated defaultDocument #15

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jul 26, 2024
Merged

Conversation

kaigoh
Copy link
Contributor

@kaigoh kaigoh commented Jul 25, 2024

The changes to the template give a predictable name to the data and etag for the default document, which allows me to do this to work nicely with SvelteKit routing:

server.onNotFound([](AsyncWebServerRequest *request)
{
if (request->hasHeader("If-None-Match") && request->getHeader("If-None-Match")->value() == String(etagDefaultDocument))
{
request->send(304);
return;
}
AsyncWebServerResponse *response = request->beginResponse_P(200, "text/html", dataDefaultDocument, sizeof(dataDefaultDocument));
response->addHeader("Content-Encoding", "gzip");
response->addHeader("ETag", etagDefaultDocument);
request->send(response); });

The changes to the template give a predictable name to the data and etag for the default document, which allows me to do this to work nicely with SvelteKit routing:

  server.onNotFound([](AsyncWebServerRequest *request)
                    {
                      if (request->hasHeader("If-None-Match") && request->getHeader("If-None-Match")->value() == String(etagDefaultDocument))
    {
      request->send(304);
      return;
    }
    AsyncWebServerResponse *response = request->beginResponse_P(200, "text/html", dataDefaultDocument, sizeof(dataDefaultDocument));
    response->addHeader("Content-Encoding", "gzip");
    response->addHeader("ETag", etagDefaultDocument);
    request->send(response); });
@BCsabaEngine BCsabaEngine changed the title Update cppCode.ts feat: dedicated defaultDocument Jul 26, 2024
@BCsabaEngine BCsabaEngine merged commit bb896d8 into BCsabaEngine:main Jul 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants