| 26 | }; |
| 27 | |
| 28 | class 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 |
nothing calls this directly
no outgoing calls
no test coverage detected