bes Updated for version 3.21.1
The Backend Server (BES) is the lower two tiers of the Hyrax data server
HttpError.cc
1//
2// Created by ndp on 2/9/24.
3//
4#include "config.h"
5
6#include <sstream>
7
8#include "BESInfo.h"
9#include "HttpError.h"
10
11namespace http {
12
13
15 info.add_tag("curl_code", std::to_string(d_curl_code));
16 info.add_tag("http_status", std::to_string(d_http_status));
17 info.add_tag("origin_url", d_origin_url);
18 info.add_tag("redirect_url", d_redirect_url);
19 info.begin_tag("response_headers");
20 for (const auto &header: d_response_headers) {
21 info.add_tag("header", header);
22 }
23 info.end_tag("response_headers");
24 info.add_tag("response_body", d_response_body);
25}
26
27
28std::string HttpError::dump() const {
29 std::stringstream msg;
30
31 msg << BESIndent::LMarg << "http::Response::dump - (" << (void *) this << ")\n";
32 BESIndent::Indent();
33 msg << BESIndent::LMarg << " curl_code: " << d_curl_code << "\n";
34 msg << BESIndent::LMarg << " http_status: " << d_http_status << "\n";
35 msg << BESIndent::LMarg << " origin_url: " << d_origin_url << "\n";
36 msg << BESIndent::LMarg << "last_accessed_url: " << d_redirect_url << "\n";
37
38 if (!d_response_headers.empty()) {
39 msg << BESIndent::LMarg << " response_headers: " << d_response_headers.size() << "\n";
40 for (const auto &hdr: d_response_headers) {
41 msg << BESIndent::LMarg << " response_header: " << hdr << "\n";
42 }
43 } else {
44 msg << BESIndent::LMarg << " response_headers: [NONE]\n";
45 }
46
47 if (!d_response_body.empty()) {
48 msg << BESIndent::LMarg << " response_body: " << d_response_body << "\n";
49 } else {
50 msg << BESIndent::LMarg << " response_body: [NONE]\n";
51 }
52 BESIndent::UnIndent();
53
54 return msg.str();
55}
56
57} // http
58
informational response object
Definition BESInfo.h:63
void add_my_error_details_to(BESInfo &info) const override
Definition HttpError.cc:14
std::string dump() const
Returns a string describing this object and its state.
Definition HttpError.cc:28
utility class for the HTTP catalog module
Definition TheBESKeys.h:51