ClientSession: SetContentType()

This commit is contained in:
Chunting Gu
2020-08-18 09:37:52 +08:00
parent b38e6c153d
commit 8106da401e
2 changed files with 8 additions and 7 deletions
+6 -4
View File
@@ -38,11 +38,13 @@ public:
headers_.Set(key, value);
}
void set_media_type(const std::string& media_type) {
// Set `Content-Type` header, e.g., ("application/json", "utf-8").
// Only applied when:
// - the request to send has no `Content-Type` header, and
// - the request has a body.
void SetContentType(const std::string& media_type,
const std::string& charset = "") {
media_type_ = media_type;
}
void set_charset(const std::string& charset) {
charset_ = charset;
}