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

Function BOOST_AUTO_TEST_CASE

test/remote-httpserverconnection.cpp:104–138  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

102 *boost::unit_test::label("http"))
103
104BOOST_AUTO_TEST_CASE(expect_100_continue)
105{
106 CreateTestUsers();
107 SetupHttpServerConnection(true);
108
109 http::request<boost::beast::http::string_body> request;
110 request.method(http::verb::get);
111 request.version(11);
112 request.target("/v1/test");
113 request.set(http::field::expect, "100-continue");
114 request.set(http::field::host, "localhost:5665");
115 request.set(http::field::accept, "application/json");
116 request.set(http::field::connection, "close");
117 request.content_length(0);
118 http::request_serializer<http::string_body> sr(request);
119 http::write_header(*client, sr);
120 client->flush();
121
122 flat_buffer buf;
123 http::response<http::string_body> response;
124 BOOST_REQUIRE_NO_THROW(http::read(*client, buf, response));
125
126 BOOST_REQUIRE_EQUAL(response.version(), 11);
127 BOOST_REQUIRE_EQUAL(response.result(), http::status::continue_);
128
129 http::write(*client, sr);
130 client->flush();
131
132 BOOST_REQUIRE_NO_THROW(http::read(*client, buf, response));
133 BOOST_REQUIRE_EQUAL(response.version(), 11);
134 BOOST_REQUIRE_EQUAL(response.result(), http::status::ok);
135 BOOST_REQUIRE_EQUAL(response.body(), "test");
136
137 BOOST_REQUIRE(Shutdown(client));
138}
139
140BOOST_AUTO_TEST_CASE(bad_request)
141{

Callers

nothing calls this directly

Calls 7

findMethod · 0.80
StartStreamingMethod · 0.80
IsClientDisconnectedMethod · 0.80
GetMethod · 0.45
getMethod · 0.45
JoinMethod · 0.45
FlushMethod · 0.45

Tested by

no test coverage detected