| 36 | } |
| 37 | |
| 38 | ananas::Future<std::pair<bool, std::string>> AFCHttpClientModule::AsyncRequest( |
| 39 | brynet::net::http::HttpRequest::HTTP_METHOD http_method, const std::string& ip, const uint16_t port, |
| 40 | const std::string& url, std::map<std::string, std::string>& params, const std::vector<std::string>& cookies, |
| 41 | const google::protobuf::Message& http_msg) |
| 42 | { |
| 43 | ananas::Promise<std::pair<bool, std::string>> promise; |
| 44 | |
| 45 | std::string http_body; |
| 46 | auto status = google::protobuf::util::MessageToJsonString(http_msg, &http_body); |
| 47 | if (!status.ok()) |
| 48 | { |
| 49 | promise.SetValue(std::make_pair(false, std::string())); |
| 50 | return promise.GetFuture(); |
| 51 | } |
| 52 | |
| 53 | return http_client_->AsyncRequest(http_method, ip, port, url, params, cookies, http_body); |
| 54 | } |
| 55 | |
| 56 | ananas::Future<std::pair<bool, std::string>> AFCHttpClientModule::AsyncRequest( |
| 57 | brynet::net::http::HttpRequest::HTTP_METHOD http_method, const std::string& ip, const uint16_t port, |