MCPcopy Create free account
hub / github.com/Icinga/icinga2 / BOOST_AUTO_TEST_CASE

Function BOOST_AUTO_TEST_CASE

test/remote-httpmessage.cpp:23–54  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

21 *boost::unit_test::label("http"))
22
23BOOST_AUTO_TEST_CASE(request_parse)
24{
25 http::request<boost::beast::http::string_body> requestOut;
26 requestOut.method(http::verb::get);
27 requestOut.target("https://localhost:5665/v1/test");
28 requestOut.set(http::field::authorization, "Basic " + Base64::Encode("invalid:invalid"));
29 requestOut.set(http::field::accept, "application/json");
30 requestOut.set(http::field::connection, "close");
31 requestOut.body() = "test";
32 requestOut.prepare_payload();
33
34 auto future = SpawnSynchronizedCoroutine([this, &requestOut](boost::asio::yield_context yc) {
35 boost::beast::flat_buffer buf;
36 HttpApiRequest request(server);
37 BOOST_REQUIRE_NO_THROW(request.ParseHeader(buf, yc));
38
39 for (const auto& field : requestOut.base()) {
40 BOOST_REQUIRE(request.count(field.name()));
41 }
42
43 BOOST_REQUIRE_NO_THROW(request.ParseBody(buf, yc));
44 BOOST_REQUIRE_EQUAL(request.body(), "test");
45
46 Shutdown(server, yc);
47 });
48
49 http::write(*client, requestOut);
50 client->flush();
51
52 Shutdown(client);
53 future.get();
54}
55
56BOOST_AUTO_TEST_CASE(request_params)
57{

Callers

nothing calls this directly

Calls 15

ParseHeaderMethod · 0.80
countMethod · 0.80
nameMethod · 0.80
ParseBodyMethod · 0.80
DecodeParamsMethod · 0.80
ParamsMethod · 0.80
IsBooleanMethod · 0.80
IsStringMethod · 0.80
closeMethod · 0.80
StartStreamingMethod · 0.80

Tested by

no test coverage detected