20#ifndef RIPPLE_RPC_JSON_BODY_H
21#define RIPPLE_RPC_JSON_BODY_H
23#include <xrpl/json/json_value.h>
24#include <xrpl/json/to_string.h>
26#include <boost/beast/core/multi_buffer.hpp>
27#include <boost/beast/http/message.hpp>
46 typename dynamic_buffer_type::const_buffers_type;
50 template <
bool isRequest,
class Fields>
52 boost::beast::http::message<isRequest, json_body, Fields>
const& m)
54 stream(m.body, [&](
void const* data,
std::size_t n) {
55 buffer_.commit(boost::asio::buffer_copy(
56 buffer_.prepare(n), boost::asio::buffer(data, n)));
61 init(boost::beast::error_code&)
noexcept
67 boost::optional<std::pair<const_buffers_type, bool>>
68 get(boost::beast::error_code& ec)
70 return {{
buffer_.data(),
false}};
86 template <
bool isRequest,
class Fields>
88 boost::beast::http::header<isRequest, Fields>
const& fields,
95 init(boost::beast::error_code& ec)
97 ec.assign(0, ec.category());
102 boost::optional<std::pair<const_buffers_type, bool>>
103 get(boost::beast::error_code& ec)
105 ec.assign(0, ec.category());
reader(boost::beast::http::message< isRequest, json_body, Fields > const &m)
dynamic_buffer_type buffer_
boost::optional< std::pair< const_buffers_type, bool > > get(boost::beast::error_code &ec)
void finish(boost::beast::error_code &)
boost::beast::multi_buffer dynamic_buffer_type
typename dynamic_buffer_type::const_buffers_type const_buffers_type
void init(boost::beast::error_code &) noexcept
void init(boost::beast::error_code &ec)
writer(boost::beast::http::header< isRequest, Fields > const &fields, value_type const &value)
boost::optional< std::pair< const_buffers_type, bool > > get(boost::beast::error_code &ec)
boost::asio::const_buffer const_buffers_type
Use hash_* containers for keys that do not need a cryptographically secure hashing algorithm.
std::string to_string(base_uint< Bits, Tag > const &a)