summaryrefslogtreecommitdiffstats
path: root/server/src/http/ext/json.cpp
blob: f03d336f4b04c56c29301b404a27425d3d5218d3 (about) (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
module;

#include <boost/beast/core.hpp>
#include <boost/json/stream_parser.hpp>

module routemon:http.ext.json$impl;

import :http.ext.json;

namespace routemon::http::ext::json {

namespace {

namespace json = boost::json;

} // namespace

auto body::reader::init(
    boost::optional<std::uint64_t> /* n */, beast::error_code& ec) noexcept
    -> void
{
  p_.reset();
  ec = {};
}

auto body::reader::finish(beast::error_code& ec) noexcept -> void
{
  p_.finish(ec);
  if (ec)
    return;
  *v_ = p_.release();
}

} // namespace routemon::http::ext::json