MCPcopy Create free account
hub / github.com/boostorg/beast / do_post

Function do_post

example/http/client/methods/http_client_methods.cpp:102–113  ·  view source on GitHub ↗

perform a post request

Source from the content-addressed store, hash-verified

100
101// perform a post request
102void do_post(beast::tcp_stream & stream,
103 http::request<http::string_body> & req,
104 beast::flat_buffer buffer,
105 http::response<http::dynamic_body> & res)
106{
107 req.target("/post");
108 req.method(beast::http::verb::post);
109 req.body() = "Some random post data";
110 req.prepare_payload(); // set content-length based on the body
111 http::write(stream, req);
112 http::read(stream, buffer, res);
113}
114
115
116// perform a delete request

Callers 1

mainFunction · 0.85

Calls 5

targetMethod · 0.80
methodMethod · 0.80
bodyMethod · 0.80
writeFunction · 0.50
readFunction · 0.50

Tested by

no test coverage detected