@@ -97,7 +97,7 @@ enum AsyncWebRequestMethodType {
9797 HTTP_MOVE = 0b0001000000000000 ,
9898 HTTP_COPY = 0b0010000000000000 ,
9999 HTTP_RESERVED = 0b0100000000000000 ,
100- HTTP_ANY = 0b0111111111111111 ,
100+ HTTP_ALL = 0b0111111111111111 ,
101101};
102102}; // namespace AsyncWebRequestMethod
103103
@@ -112,6 +112,18 @@ extern constexpr inline WebRequestMethodComposite operator|(WebRequestMethod l,
112112 return static_cast <WebRequestMethodComposite>(l) | r;
113113};
114114
115+ // HTTP_ANY is commonly defined as a macro in Arduino core HTTP client libraries (e.g., ESP8266 HTTPClient.h).
116+ // Macros are expanded by the preprocessor before C++ namespace resolution, so even a namespace-qualified
117+ // reference like AsyncWebRequestMethod::HTTP_ANY would be incorrectly expanded to AsyncWebRequestMethod::0.
118+ // To avoid this conflict, HTTP_ANY is provided here as a C++ constexpr (not a macro), after undefining
119+ // any previously defined HTTP_ANY macro. Use HTTP_ALL as the canonical non-conflicting name.
120+ #ifdef HTTP_ANY
121+ #undef HTTP_ANY
122+ #endif
123+ namespace AsyncWebRequestMethod {
124+ static constexpr AsyncWebRequestMethodType HTTP_ANY = HTTP_ALL ;
125+ } // namespace AsyncWebRequestMethod
126+
115127#if !defined(ASYNCWEBSERVER_NO_GLOBAL_HTTP_METHODS)
116128// Import the method enum values to the global namespace
117129using namespace AsyncWebRequestMethod ;
@@ -1556,7 +1568,7 @@ class AsyncWebServer : public AsyncMiddlewareChain {
15561568 bool removeHandler (AsyncWebHandler *handler);
15571569
15581570 AsyncCallbackWebHandler &on (AsyncURIMatcher uri, ArRequestHandlerFunction onRequest) {
1559- return on (std::move (uri), AsyncWebRequestMethod::HTTP_ANY , onRequest);
1571+ return on (std::move (uri), AsyncWebRequestMethod::HTTP_ALL , onRequest);
15601572 }
15611573 AsyncCallbackWebHandler &on (
15621574 AsyncURIMatcher uri, WebRequestMethodComposite method, ArRequestHandlerFunction onRequest, ArUploadHandlerFunction onUpload = nullptr ,
0 commit comments