Skip to content

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

2 participants