Skip to content

Review HTTP method enum definition to avoid collisions with plaforms ones#413

Merged
willmmiles merged 1 commit intomainfrom
requestmethod-typing
Mar 15, 2026
Merged

Review HTTP method enum definition to avoid collisions with plaforms ones#413
willmmiles merged 1 commit intomainfrom
requestmethod-typing

Conversation

@mathieucarbou
Copy link
Member

No description provided.

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Updates the library’s HTTP method handling to avoid collisions with platform-defined HTTP_ANY macros and to support a broader set of HTTP methods, while centralizing method string conversions.

Changes:

  • Reworked HTTP method enum/composite handling and introduced HTTP_ALL (with HTTP_ANY deprecated when possible).
  • Replaced inline parsing/stringification logic with asyncsrv::stringToMethod / asyncsrv::methodToString.
  • Updated handlers, examples, and docs to use the new method matching approach and HTTP_ALL.

Reviewed changes

Copilot reviewed 9 out of 9 changed files in this pull request and generated 7 comments.

Show a summary per file
File Description
src/ESPAsyncWebServer.h Redefines method enum/composite types, adds HTTP_ALL, and introduces optional external http_method integration.
src/WebRequest.cpp Switches request method storage to a single method and delegates parsing/string conversion.
src/WebHandlers.cpp Updates handler method checks to use WebRequestMethodComposite::matches().
src/WebHandlerImpl.h Defaults callback handler methods to HTTP_ALL.
src/AsyncJson.cpp Uses a shared composite for allowed JSON handler methods and updates matching logic.
src/literals.h Adds string literals for additional HTTP methods; removes ANY literal.
examples/HTTPMethods/HTTPMethods.ino Updates example usage to avoid global method names and tests backward-compatible matching.
docs/setup.md Replaces HTTP_ANY with HTTP_ALL in examples.
docs/backup/wiki.md Replaces HTTP_ANY with HTTP_ALL in archived examples.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

…ones

Formalize operations on WebServerRequestMethod

- Requests can be only one method
- String operations are free functions
- Function for matching composites

Handle collisions with other webservers

Fix HTTP_ANY macro conflict with Arduino core.  Rename the combination
value to HTTP_ALL and make it type-safe as a
WebRequestMethodComposite.  Ensure a warning is generated when
conflicts are detected, and add a deprecation alert to our
compatibility HTTP_ANY value.

Co-authored-by: GitHub Copilot <copilot@github.com>
Co-authored-by: mathieucarbou <61346+mathieucarbou@users.noreply.github.com>

Fix for #404

Fix name collision warning

Added support for standard HTTP methods for WebDAC and REST APIs.

Move global utility methods in asyncsrv namespace to avoid conflict with existing usr code

Improving example to make sure the old way to match with a bit operator (&) works.

Improve external HTTP method integration

ci(pre-commit): Apply automatic fixes

Potential fix for pull request finding

Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>

Potential fix for pull request finding

Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>

Potential fix for pull request finding

Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>

Potential fix for pull request finding

Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>

Updated examples to show teh difference between  using Arduino Core include and ESP-IDf include
@willmmiles willmmiles force-pushed the requestmethod-typing branch from 0ba9308 to 8234c1c Compare March 15, 2026 00:23
@willmmiles willmmiles merged commit e1bd972 into main Mar 15, 2026
33 checks passed
@mathieucarbou mathieucarbou deleted the requestmethod-typing branch March 15, 2026 08:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants