From 2d1c3c21e094d1e05dc4adb605a1cb8586cf26bc Mon Sep 17 00:00:00 2001 From: MichaelDvP Date: Mon, 4 Nov 2024 11:44:14 +0100 Subject: [PATCH] fix msgpack response mimetype --- lib/ESPAsyncWebServer/src/AsyncJson.h | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/lib/ESPAsyncWebServer/src/AsyncJson.h b/lib/ESPAsyncWebServer/src/AsyncJson.h index 4c12df572..18cf17613 100644 --- a/lib/ESPAsyncWebServer/src/AsyncJson.h +++ b/lib/ESPAsyncWebServer/src/AsyncJson.h @@ -7,7 +7,8 @@ #include #include -constexpr const char * JSON_MIMETYPE = "application/json"; +constexpr const char * JSON_MIMETYPE = "application/json"; +constexpr const char * MSGPACK_MIMETYPE = "application/msgpack"; class ChunkPrint : public Print { private: @@ -54,7 +55,7 @@ class AsyncJsonResponse : public AsyncAbstractResponse { : _isValid{false} , _isMsgPack{isMsgPack} { _code = 200; - _contentType = JSON_MIMETYPE; + _contentType = isMsgPack ? MSGPACK_MIMETYPE : JSON_MIMETYPE; if (isArray) _root = _jsonBuffer.add(); else