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

Method post

src/tests/api_tests.cpp:146–168  ·  view source on GitHub ↗

Helper function to post a request to "/api/v1" master endpoint and return the response.

Source from the content-addressed store, hash-verified

144 // Helper function to post a request to "/api/v1" master endpoint and return
145 // the response.
146 Future<v1::master::Response> post(
147 const process::PID<master::Master>& pid,
148 const v1::master::Call& call,
149 const ContentType& contentType,
150 const Credential& credential = DEFAULT_CREDENTIAL)
151 {
152 http::Headers headers = createBasicAuthHeaders(credential);
153 headers["Accept"] = stringify(contentType);
154
155 return http::post(
156 pid,
157 "api/v1",
158 headers,
159 serialize(contentType, call),
160 stringify(contentType))
161 .then([contentType](const http::Response& response)
162 -> Future<v1::master::Response> {
163 if (response.status != http::OK().status) {
164 return Failure("Unexpected response status " + response.status);
165 }
166 return deserialize<v1::master::Response>(contentType, response.body);
167 });
168 }
169};
170
171

Callers

nothing calls this directly

Calls 7

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

Tested by

no test coverage detected