Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(984)

Unified Diff: net/url_request/report_sender.cc

Issue 2365353004: Add Content-Type header to net::ReportSender reports (Closed)
Patch Set: update some unit test subclasses Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: net/url_request/report_sender.cc
diff --git a/net/url_request/report_sender.cc b/net/url_request/report_sender.cc
index 76f171d116a7e68fd19911b0edeace9d99f3ff5a..f52b7f81c26380e017508e34c6d3eb41ffc56ed9 100644
--- a/net/url_request/report_sender.cc
+++ b/net/url_request/report_sender.cc
@@ -45,6 +45,11 @@ void ReportSender::Send(const GURL& report_uri, const std::string& report) {
url_request->set_method("POST");
+ if (!content_type_.empty()) {
+ url_request->SetExtraRequestHeaderByName(HttpRequestHeaders::kContentType,
+ content_type_, true);
+ }
+
std::unique_ptr<UploadElementReader> reader(
UploadOwnedBytesElementReader::CreateWithString(report));
url_request->set_upload(
@@ -55,6 +60,10 @@ void ReportSender::Send(const GURL& report_uri, const std::string& report) {
raw_url_request->Start();
}
+void ReportSender::SetContentTypeHeader(const std::string& content_type) {
+ content_type_ = content_type;
+}
+
void ReportSender::SetErrorCallback(const ErrorCallback& error_callback) {
error_callback_ = error_callback;
}

Powered by Google App Engine
This is Rietveld 408576698