MCPcopy Create free account
hub / github.com/ClickHouse/ai-sdk-cpp / HttpRequestHandler

Class HttpRequestHandler

src/http/http_request_handler.h:28–58  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

26};
27
28class HttpRequestHandler {
29 public:
30 explicit HttpRequestHandler(const HttpConfig& config);
31
32 // Makes a POST request and returns the raw response wrapped in GenerateResult
33 GenerateResult post(const std::string& path,
34 const httplib::Headers& headers,
35 const std::string& body,
36 const std::string& content_type = "application/json");
37
38 // Extracts host and SSL settings from a base URL
39 static HttpConfig parse_base_url(const std::string& base_url);
40
41 private:
42 HttpConfig config_;
43
44 // Handler for processing HTTP responses
45 using ResponseHandler =
46 std::function<GenerateResult(const httplib::Result&, const std::string&)>;
47 GenerateResult make_request(const std::string& path,
48 const httplib::Headers& headers,
49 const std::string& body,
50 const std::string& content_type,
51 ResponseHandler handler);
52
53 // Execute a single HTTP request (used by retry logic)
54 GenerateResult execute_single_request(const std::string& path,
55 const httplib::Headers& headers,
56 const std::string& body,
57 const std::string& content_type);
58};
59
60} // namespace http
61} // namespace ai

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected