MCPcopy Create free account
hub / github.com/apache/mesos / post

Function post

src/tests/master_tests.cpp:7652–7674  ·  view source on GitHub ↗

TODO(bmahler): Pull up a more generic helper for making it easy to send calls and get back responses. Ideally getting back the appropriate Response::X message (e.g. Response::GetAgents).

Source from the content-addressed store, hash-verified

7650// to send calls and get back responses. Ideally getting back the
7651// appropriate Response::X message (e.g. Response::GetAgents).
7652Future<v1::master::Response> post(
7653 const process::PID<master::Master>& pid,
7654 const v1::master::Call& call)
7655{
7656 http::Headers headers = createBasicAuthHeaders(DEFAULT_CREDENTIAL);
7657 headers["Accept"] = stringify(ContentType::PROTOBUF);
7658
7659 return http::post(
7660 pid,
7661 "api/v1",
7662 headers,
7663 serialize(ContentType::PROTOBUF, call),
7664 stringify(ContentType::PROTOBUF))
7665 .then([](const http::Response& response)
7666 -> Future<v1::master::Response> {
7667 if (response.status != http::OK().status) {
7668 return Failure("Unexpected response status " + response.status);
7669 }
7670
7671 return deserialize<v1::master::Response>(
7672 ContentType::PROTOBUF, response.body);
7673 });
7674}
7675
7676
7677// This is a regression test for MESOS-9609.

Callers 15

postMethod · 0.70
launchParentContainerMethod · 0.70
launchNestedContainerMethod · 0.70
waitNestedContainerMethod · 0.70
killNestedContainerMethod · 0.70
getContainersMethod · 0.70
TEST_FFunction · 0.70
TEST_PFunction · 0.70
postMethod · 0.70
TEST_PFunction · 0.70

Calls 6

createBasicAuthHeadersFunction · 0.85
OKClass · 0.85
FailureClass · 0.85
stringifyFunction · 0.50
serializeFunction · 0.50
thenMethod · 0.45

Tested by

no test coverage detected