Index: components/cronet/android/java/src/org/chromium/net/ChromiumUrlRequest.java |
diff --git a/components/cronet/android/java/src/org/chromium/net/ChromiumUrlRequest.java b/components/cronet/android/java/src/org/chromium/net/ChromiumUrlRequest.java |
index 228682f3e65130201af8af6117a5b7737940285e..ccbf06394c3a92e27f1b73644952bfe448b818d0 100644 |
--- a/components/cronet/android/java/src/org/chromium/net/ChromiumUrlRequest.java |
+++ b/components/cronet/android/java/src/org/chromium/net/ChromiumUrlRequest.java |
@@ -319,19 +319,6 @@ public class ChromiumUrlRequest implements HttpUrlRequest { |
mStarted = true; |
- String method = mMethod; |
- if (method == null && |
- ((mUploadData != null && mUploadData.length > 0) || |
- mUploadChannel != null || mChunkedUpload)) { |
- // Default to POST if there is data to upload but no method was |
- // specified. |
- method = "POST"; |
- } |
- |
- if (method != null) { |
- nativeSetMethod(mUrlRequestAdapter, method); |
- } |
- |
if (mHeaders != null && !mHeaders.isEmpty()) { |
for (Entry<String, String> entry : mHeaders.entrySet()) { |
nativeAddHeader(mUrlRequestAdapter, entry.getKey(), |
@@ -358,6 +345,13 @@ public class ChromiumUrlRequest implements HttpUrlRequest { |
mUploadContentType); |
} |
+ // Note: The above functions to set the upload body also set the |
+ // method to POST, behind the scenes, so if mMethod is null but |
+ // there's an upload body, the method will default to POST. |
+ if (mMethod != null) { |
+ nativeSetMethod(mUrlRequestAdapter, mMethod); |
+ } |
+ |
nativeStart(mUrlRequestAdapter); |
} |
} |