httpNotFound remove trailing slash
This commit is contained in:
parent
8c8c35fb5f
commit
97f711a22d
@ -6,7 +6,10 @@
|
||||
AsyncWebServer server(80);
|
||||
|
||||
void httpNotFound(AsyncWebServerRequest* request) {
|
||||
if (request->method() == HTTP_OPTIONS) {
|
||||
const String path = request->url();
|
||||
if (path.endsWith("/") && path.length() > 1) {
|
||||
request->redirect(path.substring(0, path.length() - 1));
|
||||
} else if (request->method() == HTTP_OPTIONS) {
|
||||
request->send(200);
|
||||
} else {
|
||||
request->send(404, "text/plain", "not found");
|
||||
|
||||
Loading…
Reference in New Issue
Block a user