remove accept_ member var from request builder
This commit is contained in:
@@ -8,6 +8,7 @@ int main() {
|
|||||||
WEBCC_LOG_INIT("", webcc::LOG_CONSOLE);
|
WEBCC_LOG_INIT("", webcc::LOG_CONSOLE);
|
||||||
|
|
||||||
webcc::ClientSession session;
|
webcc::ClientSession session;
|
||||||
|
|
||||||
session.Accept("application/json");
|
session.Accept("application/json");
|
||||||
|
|
||||||
webcc::ResponsePtr r;
|
webcc::ResponsePtr r;
|
||||||
|
|||||||
@@ -22,10 +22,6 @@ RequestPtr RequestBuilder::operator()() {
|
|||||||
request->SetHeader(std::move(headers_[i - 1]), std::move(headers_[i]));
|
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 no Keep-Alive, explicitly set `Connection` to "Close".
|
||||||
if (!keep_alive_) {
|
if (!keep_alive_) {
|
||||||
request->SetHeader(headers::kConnection, "Close");
|
request->SetHeader(headers::kConnection, "Close");
|
||||||
|
|||||||
@@ -117,10 +117,10 @@ public:
|
|||||||
return *this;
|
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) {
|
RequestBuilder& Accept(const std::string& content_types) {
|
||||||
accept_ = content_types;
|
return Header(headers::kAccept, content_types);
|
||||||
return *this;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
RequestBuilder& Body(const std::string& data) {
|
RequestBuilder& Body(const std::string& data) {
|
||||||
@@ -195,10 +195,6 @@ private:
|
|||||||
// E.g., "utf-8".
|
// E.g., "utf-8".
|
||||||
std::string charset_;
|
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.
|
// Files to upload for a POST request.
|
||||||
std::vector<FormPartPtr> form_parts_;
|
std::vector<FormPartPtr> form_parts_;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user