remove accept_ member var from request builder

This commit is contained in:
Chunting Gu
2020-08-10 10:28:48 +08:00
parent 44a5a09fa6
commit b38e6c153d
3 changed files with 4 additions and 11 deletions
-4
View File
@@ -22,10 +22,6 @@ RequestPtr RequestBuilder::operator()() {
request->SetHeader(std::move(headers_[i - 1]), std::move(headers_[i]));
}
if (!accept_.empty()) {
request->SetHeader(headers::kAccept, std::move(accept_));
}
// If no Keep-Alive, explicitly set `Connection` to "Close".
if (!keep_alive_) {
request->SetHeader(headers::kConnection, "Close");
+3 -7
View File
@@ -117,10 +117,10 @@ public:
return *this;
}
// Set content types to accept.
// Set (comma separated) content types to accept.
// E.g., "application/json", "text/html, application/xhtml+xml".
RequestBuilder& Accept(const std::string& content_types) {
accept_ = content_types;
return *this;
return Header(headers::kAccept, content_types);
}
RequestBuilder& Body(const std::string& data) {
@@ -195,10 +195,6 @@ private:
// E.g., "utf-8".
std::string charset_;
// Accept content types (could be comma separated multiple types).
// E.g., "application/json", "text/html, application/xhtml+xml".
std::string accept_;
// Files to upload for a POST request.
std::vector<FormPartPtr> form_parts_;