| 59 | class SimpleHandler : public http::HTTPHandler { |
| 60 | public: |
| 61 | int handle_request(http::Request& req, http::Response& resp, std::string_view) { |
| 62 | std::string url_path(req.target()); |
| 63 | resp.set_result(200); |
| 64 | resp.headers.content_length(url_path.size()); |
| 65 | resp.headers.insert("Content-Type", "application/octet-stream"); |
| 66 | auto n = resp.write(url_path.data(), url_path.size()); |
| 67 | if (n != (ssize_t) url_path.size()) { |
| 68 | LOG_ERRNO_RETURN(0, -1, "send body failed"); |
| 69 | } |
| 70 | return 0; |
| 71 | } |
| 72 | }; |
| 73 | |
| 74 | TEST(http_client, get) { |
nothing calls this directly
no test coverage detected