Add auto test for client timeout.

This commit is contained in:
Chunting Gu
2019-09-11 14:27:35 +08:00
parent f023fb830c
commit 9166b5d99e
7 changed files with 142 additions and 31 deletions
-17
View File
@@ -51,23 +51,6 @@ RequestPtr RequestBuilder::operator()() {
return request;
}
RequestBuilder& RequestBuilder::Url(const std::string& url, bool encode) {
url_ = webcc::Url{ url, encode };
return *this;
}
RequestBuilder& RequestBuilder::Path(const std::string& path, bool encode) {
url_.AppendPath(path, encode);
return *this;
}
RequestBuilder& RequestBuilder::Query(const std::string& key,
const std::string& value,
bool encode) {
url_.AppendQuery(key, value, encode);
return *this;
}
RequestBuilder& RequestBuilder::File(const webcc::Path& path,
bool infer_media_type,
std::size_t chunk_size) {
+22 -3
View File
@@ -66,14 +66,33 @@ public:
return Method(methods::kPatch).Url(url, encode);
}
RequestBuilder& Url(const std::string& url, bool encode = false);
RequestBuilder& Url(const std::string& url, bool encode = false) {
url_ = webcc::Url{ url, encode };
return *this;
}
RequestBuilder& Port(const std::string& port) {
url_.set_port(port);
return *this;
}
RequestBuilder& Port(std::uint16_t port) {
url_.set_port(std::to_string(port));
return *this;
}
// Append a piece to the path.
RequestBuilder& Path(const std::string& path, bool encode = false);
RequestBuilder& Path(const std::string& path, bool encode = false) {
url_.AppendPath(path, encode);
return *this;
}
// Append a parameter to the query.
RequestBuilder& Query(const std::string& key, const std::string& value,
bool encode = false);
bool encode = false) {
url_.AppendQuery(key, value, encode);
return *this;
}
RequestBuilder& MediaType(const std::string& media_type) {
media_type_ = media_type;
+4
View File
@@ -75,6 +75,10 @@ public:
return query_;
}
void set_port(const std::string& port) {
port_ = port;
}
// Append a piece of path.
void AppendPath(const std::string& piece, bool encode = false);