use msgpack content-type - #2166

This commit is contained in:
proddy
2024-11-04 11:59:18 +01:00
parent 6cf4985a04
commit 1d8e32ec74

View File

@@ -7,7 +7,8 @@
#include <ESPAsyncWebServer.h>
#include <Print.h>
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<JsonArray>();
else