mirror of
https://github.com/me-no-dev/ESPAsyncWebServer.git
synced 2025-08-05 13:44:38 +02:00
Fix #143: doc re-updated and const removed
This commit is contained in:
@@ -1232,7 +1232,7 @@ For actual serving the file.
|
|||||||
|
|
||||||
### Param Rewrite With Matching
|
### Param Rewrite With Matching
|
||||||
|
|
||||||
It is possible to rewrite the request url with parameter matchg. Here is an example with one parameter:
|
It is possible to rewrite the request url with parameter match. Here is an example with one parameter:
|
||||||
Rewrite for example "/radio/{frequence}" -> "/radio?f={frequence}"
|
Rewrite for example "/radio/{frequence}" -> "/radio?f={frequence}"
|
||||||
|
|
||||||
```cpp
|
```cpp
|
||||||
@@ -1261,7 +1261,7 @@ class OneParamRewrite : public AsyncWebRewrite
|
|||||||
_paramsBackup = _params;
|
_paramsBackup = _params;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool match(AsyncWebServerRequest *request) const override {
|
bool match(AsyncWebServerRequest *request) override {
|
||||||
if(request->url().startsWith(_urlPrefix)) {
|
if(request->url().startsWith(_urlPrefix)) {
|
||||||
if(_paramIndex >= 0) {
|
if(_paramIndex >= 0) {
|
||||||
_params = _paramsBackup + request->url().substring(_paramIndex);
|
_params = _paramsBackup + request->url().substring(_paramIndex);
|
||||||
|
@@ -717,7 +717,7 @@ class AsyncWebRewrite {
|
|||||||
const String& from(void) const { return _from; }
|
const String& from(void) const { return _from; }
|
||||||
const String& toUrl(void) const { return _toUrl; }
|
const String& toUrl(void) const { return _toUrl; }
|
||||||
const String& params(void) const { return _params; }
|
const String& params(void) const { return _params; }
|
||||||
virtual bool match(AsyncWebServerRequest* request) const { return from() == request->url() && filter(request); }
|
virtual bool match(AsyncWebServerRequest* request) { return from() == request->url() && filter(request); }
|
||||||
};
|
};
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
Reference in New Issue
Block a user