Skip to content

Commit fe1c864

Browse files
committed
Not overriding Content-Type header if HttpEntityEnclosingRequestBase doesn't provide one, Closing android-async-http#838
1 parent 6bcb0a9 commit fe1c864

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

library/src/main/java/com/loopj/android/http/AsyncHttpClient.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1298,9 +1298,9 @@ protected RequestHandle sendRequest(DefaultHttpClient client, HttpContext httpCo
12981298
if (responseHandler.getUseSynchronousMode() && !responseHandler.getUsePoolThread()) {
12991299
throw new IllegalArgumentException("Synchronous ResponseHandler used in AsyncHttpClient. You should create your response handler in a looper thread or use SyncHttpClient instead.");
13001300
}
1301-
1301+
13021302
if (contentType != null) {
1303-
if (uriRequest instanceof HttpEntityEnclosingRequestBase && ((HttpEntityEnclosingRequestBase) uriRequest).getEntity() != null) {
1303+
if (uriRequest instanceof HttpEntityEnclosingRequestBase && ((HttpEntityEnclosingRequestBase) uriRequest).getEntity() != null && uriRequest.containsHeader(HEADER_CONTENT_TYPE)) {
13041304
Log.w(LOG_TAG, "Passed contentType will be ignored because HttpEntity sets content type");
13051305
} else {
13061306
uriRequest.setHeader(HEADER_CONTENT_TYPE, contentType);

0 commit comments

Comments
 (0)