mirror of
https://github.com/Xahau/xahaud.git
synced 2025-12-06 17:27:52 +00:00
Revert "Convert code to use boost::beast"
This reverts commit cc9c976b76.
This commit is contained in:
@@ -27,10 +27,10 @@
|
||||
#include <test/jtx/JSONRPCClient.h>
|
||||
#include <ripple/app/misc/NetworkOPs.h>
|
||||
#include <ripple/app/ledger/LedgerMaster.h>
|
||||
#include <boost/beast/http.hpp>
|
||||
#include <beast/http.hpp>
|
||||
#include <beast/test/yield_to.hpp>
|
||||
#include <boost/beast/websocket/detail/mask.hpp>
|
||||
#include <boost/beast/core/multi_buffer.hpp>
|
||||
#include <beast/websocket/detail/mask.hpp>
|
||||
#include <beast/core/multi_buffer.hpp>
|
||||
#include <boost/asio.hpp>
|
||||
#include <boost/asio/ssl.hpp>
|
||||
#include <boost/algorithm/string/predicate.hpp>
|
||||
@@ -42,7 +42,7 @@ namespace test {
|
||||
class ServerStatus_test :
|
||||
public beast::unit_test::suite, public beast::test::enable_yield_to
|
||||
{
|
||||
class myFields : public boost::beast::http::fields {};
|
||||
class myFields : public beast::http::fields {};
|
||||
|
||||
auto makeConfig(
|
||||
std::string const& proto,
|
||||
@@ -88,21 +88,21 @@ class ServerStatus_test :
|
||||
uint16_t port)
|
||||
{
|
||||
using namespace boost::asio;
|
||||
using namespace boost::beast::http;
|
||||
using namespace beast::http;
|
||||
request<string_body> req;
|
||||
|
||||
req.target("/");
|
||||
req.version(11);
|
||||
req.version = 11;
|
||||
req.insert("Host", host + ":" + std::to_string(port));
|
||||
req.insert("User-Agent", "test");
|
||||
req.method(boost::beast::http::verb::get);
|
||||
req.method(beast::http::verb::get);
|
||||
req.insert("Upgrade", "websocket");
|
||||
boost::beast::websocket::detail::maskgen maskgen;
|
||||
boost::beast::websocket::detail::sec_ws_key_type key;
|
||||
boost::beast::websocket::detail::make_sec_ws_key(key, maskgen);
|
||||
beast::websocket::detail::maskgen maskgen;
|
||||
beast::websocket::detail::sec_ws_key_type key;
|
||||
beast::websocket::detail::make_sec_ws_key(key, maskgen);
|
||||
req.insert("Sec-WebSocket-Key", key);
|
||||
req.insert("Sec-WebSocket-Version", "13");
|
||||
req.insert(boost::beast::http::field::connection, "upgrade");
|
||||
req.insert(beast::http::field::connection, "upgrade");
|
||||
return req;
|
||||
}
|
||||
|
||||
@@ -113,24 +113,24 @@ class ServerStatus_test :
|
||||
myFields const& fields)
|
||||
{
|
||||
using namespace boost::asio;
|
||||
using namespace boost::beast::http;
|
||||
using namespace beast::http;
|
||||
request<string_body> req;
|
||||
|
||||
req.target("/");
|
||||
req.version(11);
|
||||
req.version = 11;
|
||||
for(auto const& f : fields)
|
||||
req.insert(f.name(), f.value());
|
||||
req.insert("Host", host + ":" + std::to_string(port));
|
||||
req.insert("User-Agent", "test");
|
||||
if(body.empty())
|
||||
{
|
||||
req.method(boost::beast::http::verb::get);
|
||||
req.method(beast::http::verb::get);
|
||||
}
|
||||
else
|
||||
{
|
||||
req.method(boost::beast::http::verb::post);
|
||||
req.method(beast::http::verb::post);
|
||||
req.insert("Content-Type", "application/json; charset=UTF-8");
|
||||
req.body() = body;
|
||||
req.body = body;
|
||||
}
|
||||
req.prepare_payload();
|
||||
|
||||
@@ -140,18 +140,18 @@ class ServerStatus_test :
|
||||
void
|
||||
doRequest(
|
||||
boost::asio::yield_context& yield,
|
||||
boost::beast::http::request<boost::beast::http::string_body>&& req,
|
||||
beast::http::request<beast::http::string_body>&& req,
|
||||
std::string const& host,
|
||||
uint16_t port,
|
||||
bool secure,
|
||||
boost::beast::http::response<boost::beast::http::string_body>& resp,
|
||||
beast::http::response<beast::http::string_body>& resp,
|
||||
boost::system::error_code& ec)
|
||||
{
|
||||
using namespace boost::asio;
|
||||
using namespace boost::beast::http;
|
||||
using namespace beast::http;
|
||||
io_service& ios = get_io_service();
|
||||
ip::tcp::resolver r{ios};
|
||||
boost::beast::multi_buffer sb;
|
||||
beast::multi_buffer sb;
|
||||
|
||||
auto it =
|
||||
r.async_resolve(
|
||||
@@ -170,7 +170,7 @@ class ServerStatus_test :
|
||||
ss.async_handshake(ssl::stream_base::client, yield[ec]);
|
||||
if(ec)
|
||||
return;
|
||||
boost::beast::http::async_write(ss, req, yield[ec]);
|
||||
beast::http::async_write(ss, req, yield[ec]);
|
||||
if(ec)
|
||||
return;
|
||||
async_read(ss, sb, resp, yield[ec]);
|
||||
@@ -183,7 +183,7 @@ class ServerStatus_test :
|
||||
async_connect(sock, it, yield[ec]);
|
||||
if(ec)
|
||||
return;
|
||||
boost::beast::http::async_write(sock, req, yield[ec]);
|
||||
beast::http::async_write(sock, req, yield[ec]);
|
||||
if(ec)
|
||||
return;
|
||||
async_read(sock, sb, resp, yield[ec]);
|
||||
@@ -199,7 +199,7 @@ class ServerStatus_test :
|
||||
test::jtx::Env& env,
|
||||
boost::asio::yield_context& yield,
|
||||
bool secure,
|
||||
boost::beast::http::response<boost::beast::http::string_body>& resp,
|
||||
beast::http::response<beast::http::string_body>& resp,
|
||||
boost::system::error_code& ec)
|
||||
{
|
||||
auto const port = env.app().config()["port_ws"].
|
||||
@@ -222,7 +222,7 @@ class ServerStatus_test :
|
||||
test::jtx::Env& env,
|
||||
boost::asio::yield_context& yield,
|
||||
bool secure,
|
||||
boost::beast::http::response<boost::beast::http::string_body>& resp,
|
||||
beast::http::response<beast::http::string_body>& resp,
|
||||
boost::system::error_code& ec,
|
||||
std::string const& body = "",
|
||||
myFields const& fields = {})
|
||||
@@ -384,21 +384,21 @@ class ServerStatus_test :
|
||||
//non-secure request
|
||||
{
|
||||
boost::system::error_code ec;
|
||||
boost::beast::http::response<boost::beast::http::string_body> resp;
|
||||
beast::http::response<beast::http::string_body> resp;
|
||||
doWSRequest(env, yield, false, resp, ec);
|
||||
if(! BEAST_EXPECTS(! ec, ec.message()))
|
||||
return;
|
||||
BEAST_EXPECT(resp.result() == boost::beast::http::status::unauthorized);
|
||||
BEAST_EXPECT(resp.result() == beast::http::status::unauthorized);
|
||||
}
|
||||
|
||||
//secure request
|
||||
{
|
||||
boost::system::error_code ec;
|
||||
boost::beast::http::response<boost::beast::http::string_body> resp;
|
||||
beast::http::response<beast::http::string_body> resp;
|
||||
doWSRequest(env, yield, true, resp, ec);
|
||||
if(! BEAST_EXPECTS(! ec, ec.message()))
|
||||
return;
|
||||
BEAST_EXPECT(resp.result() == boost::beast::http::status::unauthorized);
|
||||
BEAST_EXPECT(resp.result() == beast::http::status::unauthorized);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -417,21 +417,21 @@ class ServerStatus_test :
|
||||
//non-secure request
|
||||
{
|
||||
boost::system::error_code ec;
|
||||
boost::beast::http::response<boost::beast::http::string_body> resp;
|
||||
beast::http::response<beast::http::string_body> resp;
|
||||
doHTTPRequest(env, yield, false, resp, ec);
|
||||
if(! BEAST_EXPECTS(! ec, ec.message()))
|
||||
return;
|
||||
BEAST_EXPECT(resp.result() == boost::beast::http::status::ok);
|
||||
BEAST_EXPECT(resp.result() == beast::http::status::ok);
|
||||
}
|
||||
|
||||
//secure request
|
||||
{
|
||||
boost::system::error_code ec;
|
||||
boost::beast::http::response<boost::beast::http::string_body> resp;
|
||||
beast::http::response<beast::http::string_body> resp;
|
||||
doHTTPRequest(env, yield, true, resp, ec);
|
||||
if(! BEAST_EXPECTS(! ec, ec.message()))
|
||||
return;
|
||||
BEAST_EXPECT(resp.result() == boost::beast::http::status::ok);
|
||||
BEAST_EXPECT(resp.result() == beast::http::status::ok);
|
||||
}
|
||||
};
|
||||
|
||||
@@ -441,7 +441,7 @@ class ServerStatus_test :
|
||||
testcase("Partial WS upgrade request");
|
||||
using namespace jtx;
|
||||
using namespace boost::asio;
|
||||
using namespace boost::beast::http;
|
||||
using namespace beast::http;
|
||||
Env env {*this, envconfig([](std::unique_ptr<Config> cfg)
|
||||
{
|
||||
cfg->section("port_ws").set("protocol", "ws2");
|
||||
@@ -463,7 +463,7 @@ class ServerStatus_test :
|
||||
|
||||
io_service& ios = get_io_service();
|
||||
ip::tcp::resolver r{ios};
|
||||
boost::beast::multi_buffer sb;
|
||||
beast::multi_buffer sb;
|
||||
|
||||
auto it =
|
||||
r.async_resolve(
|
||||
@@ -498,7 +498,7 @@ class ServerStatus_test :
|
||||
using namespace jtx;
|
||||
Env env {*this, makeConfig(server_protocol)};
|
||||
|
||||
boost::beast::http::response<boost::beast::http::string_body> resp;
|
||||
beast::http::response<beast::http::string_body> resp;
|
||||
boost::system::error_code ec;
|
||||
if(boost::starts_with(client_protocol, "h"))
|
||||
{
|
||||
@@ -540,23 +540,23 @@ class ServerStatus_test :
|
||||
|
||||
Json::Value jr;
|
||||
jr[jss::method] = "server_info";
|
||||
boost::beast::http::response<boost::beast::http::string_body> resp;
|
||||
beast::http::response<beast::http::string_body> resp;
|
||||
boost::system::error_code ec;
|
||||
doHTTPRequest(env, yield, secure, resp, ec, to_string(jr));
|
||||
BEAST_EXPECT(resp.result() == boost::beast::http::status::forbidden);
|
||||
BEAST_EXPECT(resp.result() == beast::http::status::forbidden);
|
||||
|
||||
myFields auth;
|
||||
auth.insert("Authorization", "");
|
||||
doHTTPRequest(env, yield, secure, resp, ec, to_string(jr), auth);
|
||||
BEAST_EXPECT(resp.result() == boost::beast::http::status::forbidden);
|
||||
BEAST_EXPECT(resp.result() == beast::http::status::forbidden);
|
||||
|
||||
auth.set("Authorization", "Basic NOT-VALID");
|
||||
doHTTPRequest(env, yield, secure, resp, ec, to_string(jr), auth);
|
||||
BEAST_EXPECT(resp.result() == boost::beast::http::status::forbidden);
|
||||
BEAST_EXPECT(resp.result() == beast::http::status::forbidden);
|
||||
|
||||
auth.set("Authorization", "Basic " + boost::beast::detail::base64_encode("me:badpass"));
|
||||
auth.set("Authorization", "Basic " + beast::detail::base64_encode("me:badpass"));
|
||||
doHTTPRequest(env, yield, secure, resp, ec, to_string(jr), auth);
|
||||
BEAST_EXPECT(resp.result() == boost::beast::http::status::forbidden);
|
||||
BEAST_EXPECT(resp.result() == beast::http::status::forbidden);
|
||||
|
||||
auto const user = env.app().config().section("port_rpc").
|
||||
get<std::string>("user").value();
|
||||
@@ -566,14 +566,14 @@ class ServerStatus_test :
|
||||
// try with the correct user/pass, but not encoded
|
||||
auth.set("Authorization", "Basic " + user + ":" + pass);
|
||||
doHTTPRequest(env, yield, secure, resp, ec, to_string(jr), auth);
|
||||
BEAST_EXPECT(resp.result() == boost::beast::http::status::forbidden);
|
||||
BEAST_EXPECT(resp.result() == beast::http::status::forbidden);
|
||||
|
||||
// finally if we use the correct user/pass encoded, we should get a 200
|
||||
auth.set("Authorization", "Basic " +
|
||||
boost::beast::detail::base64_encode(user + ":" + pass));
|
||||
beast::detail::base64_encode(user + ":" + pass));
|
||||
doHTTPRequest(env, yield, secure, resp, ec, to_string(jr), auth);
|
||||
BEAST_EXPECT(resp.result() == boost::beast::http::status::ok);
|
||||
BEAST_EXPECT(! resp.body().empty());
|
||||
BEAST_EXPECT(resp.result() == beast::http::status::ok);
|
||||
BEAST_EXPECT(! resp.body.empty());
|
||||
}
|
||||
|
||||
void
|
||||
@@ -583,7 +583,7 @@ class ServerStatus_test :
|
||||
|
||||
using namespace test::jtx;
|
||||
using namespace boost::asio;
|
||||
using namespace boost::beast::http;
|
||||
using namespace beast::http;
|
||||
Env env {*this, envconfig([&](std::unique_ptr<Config> cfg) {
|
||||
(*cfg)["port_rpc"].set("limit", to_string(limit));
|
||||
return cfg;
|
||||
@@ -607,7 +607,7 @@ class ServerStatus_test :
|
||||
ip::tcp::resolver::query{ip, to_string(port)}, yield[ec]);
|
||||
BEAST_EXPECT(! ec);
|
||||
|
||||
std::vector<std::pair<ip::tcp::socket, boost::beast::multi_buffer>> clients;
|
||||
std::vector<std::pair<ip::tcp::socket, beast::multi_buffer>> clients;
|
||||
int connectionCount {1}; //starts at 1 because the Env already has one
|
||||
//for JSONRPCCLient
|
||||
|
||||
@@ -620,7 +620,7 @@ class ServerStatus_test :
|
||||
while (connectionCount < testTo)
|
||||
{
|
||||
clients.emplace_back(
|
||||
std::make_pair(ip::tcp::socket {ios}, boost::beast::multi_buffer{}));
|
||||
std::make_pair(ip::tcp::socket {ios}, beast::multi_buffer{}));
|
||||
async_connect(clients.back().first, it, yield[ec]);
|
||||
BEAST_EXPECT(! ec);
|
||||
auto req = makeHTTPRequest(ip, port, to_string(jr), {});
|
||||
@@ -635,7 +635,7 @@ class ServerStatus_test :
|
||||
int readCount = 0;
|
||||
for (auto& c : clients)
|
||||
{
|
||||
boost::beast::http::response<boost::beast::http::string_body> resp;
|
||||
beast::http::response<beast::http::string_body> resp;
|
||||
async_read(c.first, c.second, resp, yield[ec]);
|
||||
++readCount;
|
||||
// expect the reads to fail for the clients that connected at or
|
||||
@@ -659,11 +659,11 @@ class ServerStatus_test :
|
||||
get<std::uint16_t>("port").value();
|
||||
auto const ip = env.app().config()["port_ws"].
|
||||
get<std::string>("ip").value();
|
||||
boost::beast::http::response<boost::beast::http::string_body> resp;
|
||||
beast::http::response<beast::http::string_body> resp;
|
||||
boost::system::error_code ec;
|
||||
doRequest(
|
||||
yield, makeWSUpgrade(ip, port), ip, port, true, resp, ec);
|
||||
BEAST_EXPECT(resp.result() == boost::beast::http::status::switching_protocols);
|
||||
BEAST_EXPECT(resp.result() == beast::http::status::switching_protocols);
|
||||
BEAST_EXPECT(resp.find("Upgrade") != resp.end() &&
|
||||
resp["Upgrade"] == "websocket");
|
||||
BEAST_EXPECT(resp.find("Connection") != resp.end() &&
|
||||
@@ -682,14 +682,14 @@ class ServerStatus_test :
|
||||
get<std::uint16_t>("port").value();
|
||||
auto const ip = env.app().config()["port_ws"].
|
||||
get<std::string>("ip").value();
|
||||
boost::beast::http::response<boost::beast::http::string_body> resp;
|
||||
beast::http::response<beast::http::string_body> resp;
|
||||
boost::system::error_code ec;
|
||||
// body content is required here to avoid being
|
||||
// detected as a status request
|
||||
doRequest(yield,
|
||||
makeHTTPRequest(ip, port, "foo", {}), ip, port, false, resp, ec);
|
||||
BEAST_EXPECT(resp.result() == boost::beast::http::status::forbidden);
|
||||
BEAST_EXPECT(resp.body() == "Forbidden\r\n");
|
||||
BEAST_EXPECT(resp.result() == beast::http::status::forbidden);
|
||||
BEAST_EXPECT(resp.body == "Forbidden\r\n");
|
||||
}
|
||||
|
||||
void
|
||||
@@ -699,7 +699,7 @@ class ServerStatus_test :
|
||||
|
||||
using namespace test::jtx;
|
||||
using namespace boost::asio;
|
||||
using namespace boost::beast::http;
|
||||
using namespace beast::http;
|
||||
Env env {*this};
|
||||
|
||||
auto const port = env.app().config()["port_ws"].
|
||||
@@ -722,17 +722,17 @@ class ServerStatus_test :
|
||||
if(! BEAST_EXPECT(! ec))
|
||||
return;
|
||||
|
||||
boost::beast::websocket::stream<boost::asio::ip::tcp::socket&> ws{sock};
|
||||
beast::websocket::stream<boost::asio::ip::tcp::socket&> ws{sock};
|
||||
ws.handshake(ip + ":" + to_string(port), "/");
|
||||
|
||||
// helper lambda, used below
|
||||
auto sendAndParse = [&](std::string const& req) -> Json::Value
|
||||
{
|
||||
ws.async_write_some(true, buffer(req), yield[ec]);
|
||||
ws.async_write_frame(true, buffer(req), yield[ec]);
|
||||
if(! BEAST_EXPECT(! ec))
|
||||
return Json::objectValue;
|
||||
|
||||
boost::beast::multi_buffer sb;
|
||||
beast::multi_buffer sb;
|
||||
ws.async_read(sb, yield[ec]);
|
||||
if(! BEAST_EXPECT(! ec))
|
||||
return Json::objectValue;
|
||||
@@ -741,7 +741,7 @@ class ServerStatus_test :
|
||||
Json::Reader jr;
|
||||
if(! BEAST_EXPECT(jr.parse(
|
||||
boost::lexical_cast<std::string>(
|
||||
boost::beast::buffers(sb.data())), resp)))
|
||||
beast::buffers(sb.data())), resp)))
|
||||
return Json::objectValue;
|
||||
sb.consume(sb.size());
|
||||
return resp;
|
||||
@@ -783,7 +783,7 @@ class ServerStatus_test :
|
||||
testcase("Status request over WS and RPC with/without Amendment Block");
|
||||
using namespace jtx;
|
||||
using namespace boost::asio;
|
||||
using namespace boost::beast::http;
|
||||
using namespace beast::http;
|
||||
Env env {*this, validator( envconfig([](std::unique_ptr<Config> cfg)
|
||||
{
|
||||
cfg->section("port_rpc").set("protocol", "http");
|
||||
@@ -824,9 +824,9 @@ class ServerStatus_test :
|
||||
|
||||
if(! BEAST_EXPECTS(! ec, ec.message()))
|
||||
return;
|
||||
BEAST_EXPECT(resp.result() == boost::beast::http::status::ok);
|
||||
BEAST_EXPECT(resp.result() == beast::http::status::ok);
|
||||
BEAST_EXPECT(
|
||||
resp.body().find("connectivity is working.") != std::string::npos);
|
||||
resp.body.find("connectivity is working.") != std::string::npos);
|
||||
|
||||
// mark the Network as Amendment Blocked, but still won't fail until
|
||||
// ELB is enabled (next step)
|
||||
@@ -856,9 +856,9 @@ class ServerStatus_test :
|
||||
|
||||
if(! BEAST_EXPECTS(! ec, ec.message()))
|
||||
return;
|
||||
BEAST_EXPECT(resp.result() == boost::beast::http::status::ok);
|
||||
BEAST_EXPECT(resp.result() == beast::http::status::ok);
|
||||
BEAST_EXPECT(
|
||||
resp.body().find("connectivity is working.") != std::string::npos);
|
||||
resp.body.find("connectivity is working.") != std::string::npos);
|
||||
|
||||
env.app().config().ELB_SUPPORT = true;
|
||||
|
||||
@@ -873,11 +873,11 @@ class ServerStatus_test :
|
||||
|
||||
if(! BEAST_EXPECTS(! ec, ec.message()))
|
||||
return;
|
||||
BEAST_EXPECT(resp.result() == boost::beast::http::status::internal_server_error);
|
||||
BEAST_EXPECT(resp.result() == beast::http::status::internal_server_error);
|
||||
BEAST_EXPECT(
|
||||
resp.body().find("cannot accept clients:") != std::string::npos);
|
||||
resp.body.find("cannot accept clients:") != std::string::npos);
|
||||
BEAST_EXPECT(
|
||||
resp.body().find("Server version too old") != std::string::npos);
|
||||
resp.body.find("Server version too old") != std::string::npos);
|
||||
}
|
||||
|
||||
void
|
||||
@@ -890,53 +890,53 @@ class ServerStatus_test :
|
||||
|
||||
boost::system::error_code ec;
|
||||
{
|
||||
boost::beast::http::response<boost::beast::http::string_body> resp;
|
||||
beast::http::response<beast::http::string_body> resp;
|
||||
doHTTPRequest(env, yield, false, resp, ec, "{}");
|
||||
BEAST_EXPECT(resp.result() == boost::beast::http::status::bad_request);
|
||||
BEAST_EXPECT(resp.body() == "Unable to parse request: \r\n");
|
||||
BEAST_EXPECT(resp.result() == beast::http::status::bad_request);
|
||||
BEAST_EXPECT(resp.body == "Unable to parse request: \r\n");
|
||||
}
|
||||
|
||||
Json::Value jv;
|
||||
{
|
||||
boost::beast::http::response<boost::beast::http::string_body> resp;
|
||||
beast::http::response<beast::http::string_body> resp;
|
||||
jv[jss::method] = Json::nullValue;
|
||||
doHTTPRequest(env, yield, false, resp, ec, to_string(jv));
|
||||
BEAST_EXPECT(resp.result() == boost::beast::http::status::bad_request);
|
||||
BEAST_EXPECT(resp.body() == "Null method\r\n");
|
||||
BEAST_EXPECT(resp.result() == beast::http::status::bad_request);
|
||||
BEAST_EXPECT(resp.body == "Null method\r\n");
|
||||
}
|
||||
|
||||
{
|
||||
boost::beast::http::response<boost::beast::http::string_body> resp;
|
||||
beast::http::response<beast::http::string_body> resp;
|
||||
jv[jss::method] = 1;
|
||||
doHTTPRequest(env, yield, false, resp, ec, to_string(jv));
|
||||
BEAST_EXPECT(resp.result() == boost::beast::http::status::bad_request);
|
||||
BEAST_EXPECT(resp.body() == "method is not string\r\n");
|
||||
BEAST_EXPECT(resp.result() == beast::http::status::bad_request);
|
||||
BEAST_EXPECT(resp.body == "method is not string\r\n");
|
||||
}
|
||||
|
||||
{
|
||||
boost::beast::http::response<boost::beast::http::string_body> resp;
|
||||
beast::http::response<beast::http::string_body> resp;
|
||||
jv[jss::method] = "";
|
||||
doHTTPRequest(env, yield, false, resp, ec, to_string(jv));
|
||||
BEAST_EXPECT(resp.result() == boost::beast::http::status::bad_request);
|
||||
BEAST_EXPECT(resp.body() == "method is empty\r\n");
|
||||
BEAST_EXPECT(resp.result() == beast::http::status::bad_request);
|
||||
BEAST_EXPECT(resp.body == "method is empty\r\n");
|
||||
}
|
||||
|
||||
{
|
||||
boost::beast::http::response<boost::beast::http::string_body> resp;
|
||||
beast::http::response<beast::http::string_body> resp;
|
||||
jv[jss::method] = "some_method";
|
||||
jv[jss::params] = "params";
|
||||
doHTTPRequest(env, yield, false, resp, ec, to_string(jv));
|
||||
BEAST_EXPECT(resp.result() == boost::beast::http::status::bad_request);
|
||||
BEAST_EXPECT(resp.body() == "params unparseable\r\n");
|
||||
BEAST_EXPECT(resp.result() == beast::http::status::bad_request);
|
||||
BEAST_EXPECT(resp.body == "params unparseable\r\n");
|
||||
}
|
||||
|
||||
{
|
||||
boost::beast::http::response<boost::beast::http::string_body> resp;
|
||||
beast::http::response<beast::http::string_body> resp;
|
||||
jv[jss::params] = Json::arrayValue;
|
||||
jv[jss::params][0u] = "not an object";
|
||||
doHTTPRequest(env, yield, false, resp, ec, to_string(jv));
|
||||
BEAST_EXPECT(resp.result() == boost::beast::http::status::bad_request);
|
||||
BEAST_EXPECT(resp.body() == "params unparseable\r\n");
|
||||
BEAST_EXPECT(resp.result() == beast::http::status::bad_request);
|
||||
BEAST_EXPECT(resp.body == "params unparseable\r\n");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -954,12 +954,12 @@ class ServerStatus_test :
|
||||
//raise the fee so that the server is considered overloaded
|
||||
env.app().getFeeTrack().raiseLocalFee();
|
||||
|
||||
boost::beast::http::response<boost::beast::http::string_body> resp;
|
||||
beast::http::response<beast::http::string_body> resp;
|
||||
boost::system::error_code ec;
|
||||
doHTTPRequest(env, yield, false, resp, ec);
|
||||
BEAST_EXPECT(resp.result() == boost::beast::http::status::internal_server_error);
|
||||
BEAST_EXPECT(resp.result() == beast::http::status::internal_server_error);
|
||||
std::regex body {"Server cannot accept clients"};
|
||||
BEAST_EXPECT(std::regex_search(resp.body(), body));
|
||||
BEAST_EXPECT(std::regex_search(resp.body, body));
|
||||
}
|
||||
|
||||
public:
|
||||
|
||||
Reference in New Issue
Block a user