There's some history related to this issue.
At some point I updated the CXF client code to ignore Content-Type completely. Then the side-effects caused by HttpUrlConnection started appearing:

- empty POSTs lead to HttpUrlConnection setting a form conetnt-type
- even more serious, if HTTP Proxy is used, a custom Accept is completely lost for requests with the empty payloads.

So indeed, I reverted it to have Content-Type dropped in case of empty payloads only if the async conduit is used.

I think it makes sense to let users control it via a property, as it obvious that unfortunately a single solution does not work with HttpUrlConnection - I'll take care of it. It might also make sense to check what HttpUrlConnection does in Java 8 and 9 re the above two side-effects

Cheers, Sergey


On 10/08/15 14:31, Steen Elvstrøm wrote:
I've been trying to use Apache CXF JAX-RS (version 3.0.4) to send GET
requests to a Spring Boot application. Unfortunately CFX adds a
Content-Type: */* to the request headers which is not accepted by spring
resulting in a 400 response stating "'Content-Type' cannot contain wildcard
type '*'".

Since a Content-Type header on a GET request doesn't really make sense when
the request haven't got a request entity I guess it must be a bug.

A possible workaround is to add "cxf-rt-transports-http-hc" as a dependency
and setting the property "use.async.http.conduit". Is it a valid durable way
to solve the issue?




--
View this message in context: 
http://cxf.547215.n5.nabble.com/Why-does-CXF-JAX-RS-set-content-type-on-GET-requests-with-no-body-tp5759908.html
Sent from the cxf-user mailing list archive at Nabble.com.


Reply via email to