You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cxf.apache.org by se...@apache.org on 2014/10/20 23:14:21 UTC

git commit: [CXF-6055] Updating WebClient not to add CT in case if the body is not set

Repository: cxf
Updated Branches:
  refs/heads/2.7.x-fixes 8f3a14035 -> 6867a4fd8


[CXF-6055] Updating WebClient not to add CT in case if the body is not set


Project: http://git-wip-us.apache.org/repos/asf/cxf/repo
Commit: http://git-wip-us.apache.org/repos/asf/cxf/commit/6867a4fd
Tree: http://git-wip-us.apache.org/repos/asf/cxf/tree/6867a4fd
Diff: http://git-wip-us.apache.org/repos/asf/cxf/diff/6867a4fd

Branch: refs/heads/2.7.x-fixes
Commit: 6867a4fd8668c01b73312e9ccd8f62def14dc481
Parents: 8f3a140
Author: Sergey Beryozkin <sb...@talend.com>
Authored: Mon Oct 20 22:13:58 2014 +0100
Committer: Sergey Beryozkin <sb...@talend.com>
Committed: Mon Oct 20 22:13:58 2014 +0100

----------------------------------------------------------------------
 .../main/java/org/apache/cxf/jaxrs/client/WebClient.java  | 10 +++-------
 1 file changed, 3 insertions(+), 7 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cxf/blob/6867a4fd/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/client/WebClient.java
----------------------------------------------------------------------
diff --git a/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/client/WebClient.java b/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/client/WebClient.java
index 3637ac0..cf9b6e5 100644
--- a/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/client/WebClient.java
+++ b/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/client/WebClient.java
@@ -968,13 +968,9 @@ public class WebClient extends AbstractClient {
     
     private MultivaluedMap<String, String> prepareHeaders(Class<?> responseClass, Object body) {
         MultivaluedMap<String, String> headers = getHeaders();
-        boolean contentTypeNotSet = headers.getFirst(HttpHeaders.CONTENT_TYPE) == null;
-        if (contentTypeNotSet) {
-            String ct = "*/*";
-            if (body != null) { 
-                ct = body instanceof Form ? MediaType.APPLICATION_FORM_URLENCODED 
-                                          : MediaType.APPLICATION_XML;
-            }
+        if (body != null && headers.getFirst(HttpHeaders.CONTENT_TYPE) == null) {
+            String ct = body instanceof Form ? MediaType.APPLICATION_FORM_URLENCODED 
+                                      : MediaType.APPLICATION_XML;
             headers.putSingle(HttpHeaders.CONTENT_TYPE, ct);
         }