MCPcopy Create free account
hub / github.com/SpartanJ/eepp / printResponseHeaders

Function printResponseHeaders

src/examples/http_request/http_request.cpp:6–19  ·  view source on GitHub ↗

Prints the response headers

Source from the content-addressed store, hash-verified

4
5// Prints the response headers
6void printResponseHeaders( Http::Response& response ) {
7 Http::Response::FieldTable headers = response.getHeaders();
8
9 std::cout << "Response:" << std::endl;
10 std::cout << "HTTP/" << response.getMajorHttpVersion() << "." << response.getMinorHttpVersion()
11 << " " << response.getStatus() << " "
12 << Http::Response::statusToString( response.getStatus() ) << std::endl;
13
14 for ( auto&& head : headers ) {
15 std::cout << head.first << ": " << head.second << std::endl;
16 }
17
18 std::cout << std::endl;
19}
20
21EE_MAIN_FUNC int main( int argc, char* argv[] ) {
22 args::ArgumentParser parser( "HTTP request program example" );

Callers 1

mainFunction · 0.85

Calls 4

getHeadersMethod · 0.80
getMajorHttpVersionMethod · 0.80
getMinorHttpVersionMethod · 0.80
getStatusMethod · 0.45

Tested by

no test coverage detected