diff options
Diffstat (limited to 'server/src/http/ext/json.cpp')
| -rw-r--r-- | server/src/http/ext/json.cpp | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/server/src/http/ext/json.cpp b/server/src/http/ext/json.cpp new file mode 100644 index 0000000..f03d336 --- /dev/null +++ b/server/src/http/ext/json.cpp | |||
| @@ -0,0 +1,34 @@ | |||
| 1 | module; | ||
| 2 | |||
| 3 | #include <boost/beast/core.hpp> | ||
| 4 | #include <boost/json/stream_parser.hpp> | ||
| 5 | |||
| 6 | module routemon:http.ext.json$impl; | ||
| 7 | |||
| 8 | import :http.ext.json; | ||
| 9 | |||
| 10 | namespace routemon::http::ext::json { | ||
| 11 | |||
| 12 | namespace { | ||
| 13 | |||
| 14 | namespace json = boost::json; | ||
| 15 | |||
| 16 | } // namespace | ||
| 17 | |||
| 18 | auto body::reader::init( | ||
| 19 | boost::optional<std::uint64_t> /* n */, beast::error_code& ec) noexcept | ||
| 20 | -> void | ||
| 21 | { | ||
| 22 | p_.reset(); | ||
| 23 | ec = {}; | ||
| 24 | } | ||
| 25 | |||
| 26 | auto body::reader::finish(beast::error_code& ec) noexcept -> void | ||
| 27 | { | ||
| 28 | p_.finish(ec); | ||
| 29 | if (ec) | ||
| 30 | return; | ||
| 31 | *v_ = p_.release(); | ||
| 32 | } | ||
| 33 | |||
| 34 | } // namespace routemon::http::ext::json | ||