diff options
| -rw-r--r-- | zencore/httpserver.cpp | 18 | ||||
| -rw-r--r-- | zencore/include/zencore/httpserver.h | 4 |
2 files changed, 21 insertions, 1 deletions
diff --git a/zencore/httpserver.cpp b/zencore/httpserver.cpp index 2941c287d..8e04ddfb6 100644 --- a/zencore/httpserver.cpp +++ b/zencore/httpserver.cpp @@ -11,6 +11,7 @@ #include <http.h> #include <new.h> #include <zencore/compactbinary.h> +#include <zencore/compactbinarypackage.h> #include <zencore/iobuffer.h> #include <zencore/refcount.h> #include <zencore/string.h> @@ -381,6 +382,23 @@ HttpServerRequest::ReadPayloadObject() } } +CbPackage +HttpServerRequest::ReadPayloadPackage() +{ + IoBuffer Payload = ReadPayload(); + + if (!Payload) + { + return CbPackage(); + } + + CbObject PackageObject = LoadCompactBinaryObject(std::move(Payload)); + + CbPackage Package(PackageObject); + + return Package; +} + ////////////////////////////////////////////////////////////////////////// // // http.sys implementation diff --git a/zencore/include/zencore/httpserver.h b/zencore/include/zencore/httpserver.h index 9f19479c1..6412a5a9a 100644 --- a/zencore/include/zencore/httpserver.h +++ b/zencore/include/zencore/httpserver.h @@ -22,6 +22,7 @@ using HttpContentType = ZenContentType; class IoBuffer; class CbObject; +class CbPackage; class StringBuilderBase; enum class HttpVerb @@ -219,12 +220,13 @@ public: /** Read POST/PUT payload This will return a null buffer if the contents are not fully available yet, and the handler should - at that point return - another completion request will be issues once the contents have been received + at that point return - another completion request will be issued once the contents have been received fully. */ virtual IoBuffer ReadPayload() = 0; ZENCORE_API CbObject ReadPayloadObject(); + ZENCORE_API CbPackage ReadPayloadPackage(); /** Respond with payload |