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

Unified Diff: net/url_request/url_fetcher_core.cc

Issue 12226008: Allow no content-type for POST, PUT and PATCH methods. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Created 7 years, 10 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
« net/url_request/url_fetcher.h ('K') | « net/url_request/url_fetcher.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/url_request/url_fetcher_core.cc
diff --git a/net/url_request/url_fetcher_core.cc b/net/url_request/url_fetcher_core.cc
index 11c89d225cbec2f2c041dc1d792e5f382e87dccc..2216347629c4796afb051430ceb35e31711a3293 100644
--- a/net/url_request/url_fetcher_core.cc
+++ b/net/url_request/url_fetcher_core.cc
@@ -734,13 +734,17 @@ void URLFetcherCore::StartURLRequest() {
case URLFetcher::POST:
case URLFetcher::PUT:
case URLFetcher::PATCH:
- DCHECK(!upload_content_type_.empty());
+ // |upload_content_type_| must be set if there is (non-empty) upload
+ // content.
+ DCHECK(!(is_chunked_upload_ || upload_content_) ||
+ !upload_content_type_.empty());
mmenke 2013/02/06 16:23:58 Rather than this, I'd prefer a design that require
hidehiko 2013/02/06 17:19:49 Indeed. I just allowed SetUploadData("", "") for e
request_->set_method(
request_type_ == URLFetcher::POST ? "POST" :
request_type_ == URLFetcher::PUT ? "PUT" : "PATCH");
- extra_request_headers_.SetHeader(HttpRequestHeaders::kContentType,
- upload_content_type_);
+ if (!upload_content_type_.empty())
+ extra_request_headers_.SetHeader(HttpRequestHeaders::kContentType,
+ upload_content_type_);
mmenke 2013/02/06 16:23:58 nit: Use braces when body is more than one line.
hidehiko 2013/02/06 17:19:49 Done.
if (upload_content_)
request_->set_upload(upload_content_.Pass());
current_upload_bytes_ = -1;
« net/url_request/url_fetcher.h ('K') | « net/url_request/url_fetcher.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698