mirror of
https://github.com/esp8266/Arduino.git
synced 2025-07-26 07:02:15 +03:00
Implemented support for filters and removable routes in ESP8266WebServer (#9152)
* feat: added filters and removeable routes * Update Filters.ino * fix: clang-format * chore: updated docs * chore: updated doc * fix: use new implementation * fix: filters.ino example * fix: filters.ino * fix: formatting * fix: formatting (2)
This commit is contained in:
@ -54,8 +54,10 @@ Client request handlers
|
||||
|
||||
.. code:: cpp
|
||||
|
||||
void on();
|
||||
RequestHandler<ServerType>& on();
|
||||
bool removeRoute();
|
||||
void addHandler();
|
||||
bool removeHandler();
|
||||
void onNotFound();
|
||||
void onFileUpload();
|
||||
|
||||
@ -64,9 +66,26 @@ Client request handlers
|
||||
.. code:: cpp
|
||||
|
||||
server.on("/", handlerFunction);
|
||||
server.removeRoute("/"); // Removes any route which points to "/" and has HTTP_ANY attribute
|
||||
server.removeRoute("/", HTTP_GET); // Removes any route which points to "/" and has HTTP_GET attribute
|
||||
server.onNotFound(handlerFunction); // called when handler is not assigned
|
||||
server.onFileUpload(handlerFunction); // handle file uploads
|
||||
|
||||
Client request filters
|
||||
^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
.. code:: cpp
|
||||
|
||||
RequestHandler<ServerType>& setFilter();
|
||||
|
||||
*Example:*
|
||||
|
||||
More details about this in `Filters.ino` example.
|
||||
|
||||
.. code:: cpp
|
||||
|
||||
server.on("/", handlerFunction).setFilter(ON_AP_FILTER)
|
||||
|
||||
Sending responses to the client
|
||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
|
Reference in New Issue
Block a user