httpNotFound remove trailing slash
This commit is contained in:
parent
8c8c35fb5f
commit
97f711a22d
@ -5,15 +5,18 @@
|
||||
|
||||
AsyncWebServer server(80);
|
||||
|
||||
void httpNotFound(AsyncWebServerRequest *request) {
|
||||
if (request->method() == HTTP_OPTIONS) {
|
||||
void httpNotFound(AsyncWebServerRequest* request) {
|
||||
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");
|
||||
}
|
||||
}
|
||||
|
||||
void httpRestart([[maybe_unused]] AsyncWebServerRequest *request) {
|
||||
void httpRestart([[maybe_unused]] AsyncWebServerRequest* request) {
|
||||
systemRequestRestart();
|
||||
request->send(200, "application/json", "true");
|
||||
}
|
||||
@ -30,4 +33,4 @@ void httpSetup() {
|
||||
|
||||
void httpStop() {
|
||||
server.end();
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user