Skip to content

Support efficient parsing of Request ResourceParameters #62

Closed
@btittelbach

Description

@btittelbach

Is your feature request related to a problem? Please describe.
It seems that the recommend way to parse a requests RequestParameters, is to call isRequestParameterSet and then getRequestParameter for all the key-strings that might make up a query.
Both of these Methods translate to a for-loop which iterates though the whole list of parameters, doing string compare on each step.
Unfortunately getRequestParameter in itself is insufficient to check for the existence of a parameter since it will return "" when a parameter is unset or set to empty. getRequestParameterInt is even worse, since it will return 0 for unset parameters and thus one can't differentiate from parameters set to value 0.

Describe the solution you'd like
In order to improve response timing, I'd like a method that combines isRequestParameterSet and getRequestParameter. e.g. getRequestParameterIfExists which returns true/false and sets the parameter into a given argument.

Describe alternatives you've considered
ESP32AsyncWebserver let's people iterate for the parameters and do string comparison themselves, which is better than iterating twice but worse that a getRequestParameterIfExists method, since such a loop can't abort early and not exclude parameters from checking that have already been found.

Metadata

Metadata

Assignees

Labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions