Add automation test for http client based on httpbin.org

This commit is contained in:
Chunting Gu
2019-04-15 16:59:43 +08:00
parent df4bb33bd8
commit ddfcecccc6
6 changed files with 244 additions and 98 deletions
-33
View File
@@ -85,37 +85,4 @@ void HttpRequestBuilder::SetContent(HttpRequestPtr request,
request->SetContent(std::move(data), true);
}
//void HttpRequestBuilder::CreateFormData(std::string* data,
// const std::string& boundary) {
// for (auto& pair : files_) {
// data->append("--" + boundary + kCRLF);
//
// // Content-Disposition header
// data->append("Content-Disposition: form-data");
// if (!pair.first.empty()) {
// data->append("; name=\"" + pair.first + "\"");
// }
// if (!pair.second.file_name().empty()) {
// data->append("; filename=\"" + pair.second.file_name() + "\"");
// }
// data->append(kCRLF);
//
// // Content-Type header
// if (!pair.second.mime_type().empty()) {
// data->append("Content-Type: " + pair.second.mime_type());
// data->append(kCRLF);
// }
//
// data->append(kCRLF);
//
// // Payload
// data->append(pair.second.data());
//
// data->append(kCRLF);
// }
//
// data->append("--" + boundary + "--");
// data->append(kCRLF);
//}
} // namespace webcc
+1 -3
View File
@@ -94,7 +94,7 @@ public:
return *this;
}
HttpRequestBuilder& KeepAlive(bool keep_alive) {
HttpRequestBuilder& KeepAlive(bool keep_alive = true) {
keep_alive_ = keep_alive;
return *this;
}
@@ -107,8 +107,6 @@ public:
private:
void SetContent(HttpRequestPtr request, std::string&& data);
//void CreateFormData(std::string* data, const std::string& boundary);
private:
std::string method_;