Skip to content

Commit af83624

Browse files
committed
Fix bug introduced in #400 in method matching for AsyncCallbackJsonWebHandler
1 parent ccf5aec commit af83624

1 file changed

Lines changed: 6 additions & 4 deletions

File tree

src/AsyncJson.cpp

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -112,15 +112,17 @@ size_t AsyncMessagePackResponse::_fillBuffer(uint8_t *data, size_t len) {
112112
#endif
113113

114114
// Body handler supporting both content types: JSON and MessagePack
115-
constexpr static bool JsonHandlerMethods =
116-
AsyncWebRequestMethod::HTTP_GET | AsyncWebRequestMethod::HTTP_POST | AsyncWebRequestMethod::HTTP_PUT | AsyncWebRequestMethod::HTTP_PATCH;
117115

118116
#if ARDUINOJSON_VERSION_MAJOR == 6
119117
AsyncCallbackJsonWebHandler::AsyncCallbackJsonWebHandler(AsyncURIMatcher uri, ArJsonRequestHandlerFunction onRequest, size_t maxJsonBufferSize)
120-
: _uri(std::move(uri)), _method(JsonHandlerTypes), _onRequest(onRequest), maxJsonBufferSize(maxJsonBufferSize), _maxContentLength(16384) {}
118+
: _uri(std::move(uri)),
119+
_method(AsyncWebRequestMethod::HTTP_GET | AsyncWebRequestMethod::HTTP_POST | AsyncWebRequestMethod::HTTP_PUT | AsyncWebRequestMethod::HTTP_PATCH),
120+
_onRequest(onRequest), maxJsonBufferSize(maxJsonBufferSize), _maxContentLength(16384) {}
121121
#else
122122
AsyncCallbackJsonWebHandler::AsyncCallbackJsonWebHandler(AsyncURIMatcher uri, ArJsonRequestHandlerFunction onRequest)
123-
: _uri(std::move(uri)), _method(JsonHandlerMethods), _onRequest(onRequest), _maxContentLength(16384) {}
123+
: _uri(std::move(uri)),
124+
_method(AsyncWebRequestMethod::HTTP_GET | AsyncWebRequestMethod::HTTP_POST | AsyncWebRequestMethod::HTTP_PUT | AsyncWebRequestMethod::HTTP_PATCH),
125+
_onRequest(onRequest), _maxContentLength(16384) {}
124126
#endif
125127

126128
bool AsyncCallbackJsonWebHandler::canHandle(AsyncWebServerRequest *request) const {

0 commit comments

Comments
 (0)