MCPcopy Create free account
hub / github.com/3rdparty/libprocess / post

Function post

src/http.cpp:2422–2450  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2420
2421
2422Future<Response> post(
2423 const URL& url,
2424 const Option<Headers>& headers,
2425 const Option<string>& body,
2426 const Option<string>& contentType)
2427{
2428 if (body.isNone() && contentType.isSome()) {
2429 return Failure("Attempted to do a POST with a Content-Type but no body");
2430 }
2431
2432 Request _request;
2433 _request.method = "POST";
2434 _request.url = url;
2435 _request.keepAlive = false;
2436
2437 if (headers.isSome()) {
2438 _request.headers = headers.get();
2439 }
2440
2441 if (body.isSome()) {
2442 _request.body = body.get();
2443 }
2444
2445 if (contentType.isSome()) {
2446 _request.headers["Content-Type"] = contentType.get();
2447 }
2448
2449 return request(_request, false);
2450}
2451
2452
2453Future<Response> post(

Callers 4

foreachFunction · 0.50
TEST_FFunction · 0.50
TEST_PFunction · 0.50
TEST_FFunction · 0.50

Calls 3

FailureClass · 0.85
requestFunction · 0.85
getMethod · 0.45

Tested by 4

foreachFunction · 0.40
TEST_FFunction · 0.40
TEST_PFunction · 0.40
TEST_FFunction · 0.40