Skip to content

Commit f977d60

Browse files
ci(pre-commit): Apply automatic fixes
1 parent 31bff34 commit f977d60

File tree

3 files changed

+15
-17
lines changed

3 files changed

+15
-17
lines changed

libraries/WebServer/examples/Middleware/Middleware.ino

+5-5
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,17 @@
11
/**
22
* Basic example of using Middlewares with WebServer
3-
*
3+
*
44
* Middleware are common request/response processing functions that can be applied globally to all incoming requests or to specific handlers.
55
* They allow for a common processing thus saving memory and space to avoid duplicating code or states on multiple handlers.
6-
*
6+
*
77
* Once the example is flashed (with the correct WiFi credentials), you can test the following scenarios with the listed curl commands:
88
* - CORS Middleware: answers to OPTIONS requests with the specified CORS headers and also add CORS headers to the response when the request has the Origin header
99
* - Logging Middleware: logs the request and response to an output in a curl-like format
10-
* - Authentication Middleware: test the authentication with Digest Auth
11-
*
10+
* - Authentication Middleware: test the authentication with Digest Auth
11+
*
1212
* You can also add your own Middleware by extending the Middleware class and implementing the run method.
1313
* When implementing a Middleware, you can decide when to call the next Middleware in the chain by calling next().
14-
*
14+
*
1515
* Middleware are execute in order of addition, the ones attached to the server will be executed first.
1616
*/
1717
#include <WiFi.h>

libraries/WebServer/src/WebServer.h

+10-10
Original file line numberDiff line numberDiff line change
@@ -193,16 +193,16 @@ class WebServer {
193193
int headers() const; // get header count
194194
bool hasHeader(const String &name) const; // check if header exists
195195

196-
int clientContentLength() const; // return "content-length" of incoming HTTP header from "_currentClient"
197-
const String version() const; // get the HTTP version string
198-
String hostHeader() const; // get request host header if available or empty String if not
199-
200-
int responseCode() const; // get the HTTP response code set
201-
int responseHeaders() const; // get the HTTP response headers count
202-
const String &responseHeader(String name) const; // get the HTTP response header value by name
203-
const String &responseHeader(int i) const; // get the HTTP response header value by number
204-
const String &responseHeaderName(int i) const; // get the HTTP response header name by number
205-
bool hasResponseHeader(const String& name) const; // check if response header exists
196+
int clientContentLength() const; // return "content-length" of incoming HTTP header from "_currentClient"
197+
const String version() const; // get the HTTP version string
198+
String hostHeader() const; // get request host header if available or empty String if not
199+
200+
int responseCode() const; // get the HTTP response code set
201+
int responseHeaders() const; // get the HTTP response headers count
202+
const String &responseHeader(String name) const; // get the HTTP response header value by name
203+
const String &responseHeader(int i) const; // get the HTTP response header value by number
204+
const String &responseHeaderName(int i) const; // get the HTTP response header name by number
205+
bool hasResponseHeader(const String &name) const; // check if response header exists
206206

207207
// send response to the client
208208
// code - HTTP response code, can be 200 or 404

libraries/WebServer/src/detail/RequestHandlersImpl.h

-2
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010

1111
using namespace mime;
1212

13-
1413
RequestHandler &RequestHandler::addMiddleware(Middleware *middleware) {
1514
if (!_chain) {
1615
_chain = new MiddlewareChain();
@@ -44,7 +43,6 @@ bool RequestHandler::process(WebServer &server, HTTPMethod requestMethod, String
4443
}
4544
}
4645

47-
4846
class FunctionRequestHandler : public RequestHandler {
4947
public:
5048
FunctionRequestHandler(WebServer::THandlerFunction fn, WebServer::THandlerFunction ufn, const Uri &uri, HTTPMethod method)

0 commit comments

Comments
 (0)