Introduce request#isMethod(...) to check the http method of the request (fixes #398)#399
Closed
mathieucarbou wants to merge 1 commit intomainfrom
Closed
Introduce request#isMethod(...) to check the http method of the request (fixes #398)#399mathieucarbou wants to merge 1 commit intomainfrom
mathieucarbou wants to merge 1 commit intomainfrom
Conversation
5 tasks
There was a problem hiding this comment.
Pull request overview
This PR introduces AsyncWebServerRequest::isMethod(...) to provide correct HTTP method matching across platforms, specifically addressing RP2040/RP2350 where request methods are not a bitmask and &-based checks produce false positives (issue #398).
Changes:
- Added
AsyncWebServerRequest::isMethod(WebRequestMethodComposite)with RP2040/RP2350-specific semantics (equality / HTTP_ANY). - Updated handler method checks to use
request->isMethod(...)instead of bitwise&. - Updated
methodToString()to useisMethod(...)for method name resolution.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
src/ESPAsyncWebServer.h |
Adds AsyncWebServerRequest::isMethod(...) with RP2040/RP2350-specific handling. |
src/WebHandlers.cpp |
Switches handler method filtering to request->isMethod(_method) to avoid RP false positives. |
src/WebRequest.cpp |
Updates methodToString() to rely on isMethod(...) instead of & checks. |
src/AsyncJson.cpp |
Changes JSON handler method filtering logic (but currently introduces a behavior regression by ignoring _method). |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
ebe1f84 to
e8fbf42
Compare
Member
Author
|
Closing in favor of #400 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #398
Note: this PR does not fix the definition in arduino-pico.
Instead, it provides a new way to check for a request method, and this way is implemented differently in PICO.
If users are still reegistering their handler in PICO with
|like thatthen of course it won't solve anything.