You should be able to create your own RequestHandler implementation that does this stuff, hopefully extending the existing implementation to make things easier.
The existing ones are located at
#include "detail/RequestHandlersImpl.h"
So we go there next.
Basically - just implement the request handler class.
class MyHandler : public RequestHandler {
bool canHandle(HTTPMethod method, String uri) {
return uri != null && uri.startsWith("/brightness/");
}
bool handle(ESP8266WebServer& server, HTTPMethod requestMethod, String requestUri) {
/* do brighness stuff here */
}
} myHandler;
void setup() {
server.addHandler(&myHandler);
}
If you need a lot of different ones, then alter the class to take a closure and a uri prefix in the constructor.
To handle a URL starting with "/brightness" you just need:
server.on("/brightness", myBrightnessHandler);
In the function myBrightnessHandler() you must parse the URL, say using the indexOf() method of the String class. Google for Arduino parse querystring for examples.
PaulMurrayCbr's reply got there first as I was typing this.
OK. Is entering the URL something like this acceptable to you, which is how a GET request would be presented? That should work with your existing server.on construct:
OK. If the server.on() construct is too inflexible, then you have got PaulMurrayCbr's solution, or you could use a cruder method of explicitly analyzing everything the browser client is sending like in the code example here: Arduino Project Hub