Fix #143: doc re-updated and const removed

This commit is contained in:
Mathieu Carbou
2024-10-24 10:21:17 +02:00
parent a7c9effc85
commit 41d6ccb97c
2 changed files with 3 additions and 3 deletions

View File

@@ -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);

View File

@@ -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); }
}; };
/* /*