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

Unified Diff: net/url_request/report_sender.cc

Issue 2365353004: Add Content-Type header to net::ReportSender reports (Closed)
Patch Set: make content type a required parameter to Send() 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..e98dae394fefbf512e7109d3aca5549202b74d72 100644
--- a/net/url_request/report_sender.cc
+++ b/net/url_request/report_sender.cc
@@ -32,7 +32,9 @@ ReportSender::~ReportSender() {
base::STLDeleteElements(&inflight_requests_);
}
-void ReportSender::Send(const GURL& report_uri, const std::string& report) {
+void ReportSender::Send(const GURL& report_uri,
+ const std::string& content_type,
+ const std::string& report) {
std::unique_ptr<URLRequest> url_request =
request_context_->CreateRequest(report_uri, DEFAULT_PRIORITY, this);
@@ -43,6 +45,9 @@ void ReportSender::Send(const GURL& report_uri, const std::string& report) {
}
url_request->SetLoadFlags(load_flags);
+ url_request->SetExtraRequestHeaderByName(HttpRequestHeaders::kContentType,
+ content_type, true);
+
url_request->set_method("POST");
std::unique_ptr<UploadElementReader> reader(

Powered by Google App Engine
This is Rietveld 408576698