7 #include <boost/beast/http/dynamic_body.hpp> 8 #include <boost/beast/http/message.hpp> 10 #include "strings/stringpiece.h" 14 class FiberSyncSocket;
24 using Response = boost::beast::http::response<boost::beast::http::dynamic_body>;
25 using Verb = boost::beast::http::verb;
30 boost::system::error_code Connect(StringPiece host, StringPiece service);
32 boost::system::error_code Send(Verb verb, StringPiece url, StringPiece body, Response* response);
33 boost::system::error_code Send(Verb verb, StringPiece url, Response* response) {
34 return Send(verb, url, StringPiece{}, response);
39 bool IsConnected()
const;
41 void set_connect_timeout_ms(uint32_t ms) { connect_timeout_ms_ = ms; }
44 void AddHeader(std::string name, std::string value) {
45 headers_.emplace_back(std::move(name), std::move(value));
50 uint32_t connect_timeout_ms_ = 2000;
52 using HeaderPair = std::pair<std::string, std::string>;
54 std::vector<HeaderPair> headers_;
55 std::unique_ptr<FiberSyncSocket> socket_;