Replies: 1 comment 1 reply
-
|
This is not a bug but an expected situation which is documented and also on the examples. |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Description:
When two routes share the same HTTP method and one path is a prefix of the other, the shorter route intercepts requests intended for the longer one if it's registered first.
Example:
// Registered first
server.on("/api/resource", HTTP_POST, handlerA);// Registered second
server.on("/api/resource/action", HTTP_POST, handlerB);A POST to /api/resource/action hits handlerA instead of handlerB.
Reversing the registration order (specific route first) works around the issue.
Workaround: Register the more specific route before the general one, or use non-overlapping paths.
I only tested this with POST method but i imagine it might happen with others
Is this expected or would this be considered a bug? If it is considered a bug has it been addressed in newer versions?
Version 3.6.0 is just the most current version in the platformio registry
Beta Was this translation helpful? Give feedback.
All reactions