Skip to content

Commit

Permalink
ci(pre-commit): Apply automatic fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
pre-commit-ci-lite[bot] committed Jun 13, 2024
1 parent e7bb7fe commit 7f11be6
Show file tree
Hide file tree
Showing 5 changed files with 29 additions and 19 deletions.
30 changes: 20 additions & 10 deletions libraries/WebServer/examples/Filters/Filters.ino
Original file line number Diff line number Diff line change
Expand Up @@ -71,18 +71,28 @@ void setup(void) {
}

// This route will be accessible by STA clients only
server.on("/", [&]() {
digitalWrite(led, 1);
server.send(200, "text/plain", "Hi!, This route is accessible for STA clients only");
digitalWrite(led, 0);
}).setFilter(ON_STA_FILTER);
server
.on(
"/",
[&]() {
digitalWrite(led, 1);
server.send(200, "text/plain", "Hi!, This route is accessible for STA clients only");
digitalWrite(led, 0);
}
)
.setFilter(ON_STA_FILTER);

// This route will be accessible by AP clients only
server.on("/", [&]() {
digitalWrite(led, 1);
server.send(200, "text/plain", "Hi!, This route is accessible for AP clients only");
digitalWrite(led, 0);
}).setFilter(ON_AP_FILTER);
server
.on(
"/",
[&]() {
digitalWrite(led, 1);
server.send(200, "text/plain", "Hi!, This route is accessible for AP clients only");
digitalWrite(led, 0);
}
)
.setFilter(ON_AP_FILTER);

server.on("/inline", []() {
server.send(200, "text/plain", "this works as well");
Expand Down
6 changes: 3 additions & 3 deletions libraries/WebServer/src/WebServer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -306,15 +306,15 @@ void WebServer::requestAuthentication(HTTPAuthMethod mode, const char *realm, co
send(401, String(FPSTR(mimeTable[html].mimeType)), authFailMsg);
}

RequestHandler& WebServer::on(const Uri &uri, WebServer::THandlerFunction handler) {
RequestHandler &WebServer::on(const Uri &uri, WebServer::THandlerFunction handler) {
return on(uri, HTTP_ANY, handler);
}

RequestHandler& WebServer::on(const Uri &uri, HTTPMethod method, WebServer::THandlerFunction fn) {
RequestHandler &WebServer::on(const Uri &uri, HTTPMethod method, WebServer::THandlerFunction fn) {
return on(uri, method, fn, _fileUploadHandler);
}

RequestHandler& WebServer::on(const Uri &uri, HTTPMethod method, WebServer::THandlerFunction fn, WebServer::THandlerFunction ufn) {
RequestHandler &WebServer::on(const Uri &uri, HTTPMethod method, WebServer::THandlerFunction fn, WebServer::THandlerFunction ufn) {
FunctionRequestHandler *handler = new FunctionRequestHandler(fn, ufn, uri, method);
_addRequestHandler(handler);
return *handler;
Expand Down
6 changes: 3 additions & 3 deletions libraries/WebServer/src/WebServer.h
Original file line number Diff line number Diff line change
Expand Up @@ -145,9 +145,9 @@ class WebServer {

typedef std::function<void(void)> THandlerFunction;
typedef std::function<bool(WebServer &server)> FilterFunction;
RequestHandler& on(const Uri &uri, THandlerFunction fn);
RequestHandler& on(const Uri &uri, HTTPMethod method, THandlerFunction fn);
RequestHandler& on(const Uri &uri, HTTPMethod method, THandlerFunction fn, THandlerFunction ufn); //ufn handles file uploads
RequestHandler &on(const Uri &uri, THandlerFunction fn);
RequestHandler &on(const Uri &uri, HTTPMethod method, THandlerFunction fn);
RequestHandler &on(const Uri &uri, HTTPMethod method, THandlerFunction fn, THandlerFunction ufn); //ufn handles file uploads
bool removeRoute(const char *uri);
bool removeRoute(const char *uri, HTTPMethod method);
bool removeRoute(const String &uri);
Expand Down
2 changes: 1 addition & 1 deletion libraries/WebServer/src/detail/RequestHandler.h
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ class RequestHandler {
(void)raw;
}

virtual RequestHandler& setFilter(std::function<bool(WebServer&)> filter) {
virtual RequestHandler &setFilter(std::function<bool(WebServer &)> filter) {
(void)filter;
return *this;
}
Expand Down
4 changes: 2 additions & 2 deletions libraries/WebServer/src/detail/RequestHandlersImpl.h
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ class FunctionRequestHandler : public RequestHandler {
}
}

FunctionRequestHandler& setFilter(WebServer::FilterFunction filter) {
FunctionRequestHandler &setFilter(WebServer::FilterFunction filter) {
_filter = filter;
return *this;
}
Expand Down Expand Up @@ -243,7 +243,7 @@ class StaticRequestHandler : public RequestHandler {
return (result);
} // calcETag

StaticRequestHandler& setFilter(WebServer::FilterFunction filter) {
StaticRequestHandler &setFilter(WebServer::FilterFunction filter) {
_filter = filter;
return *this;
}
Expand Down

0 comments on commit 7f11be6

Please sign in to comment.