Uploaded image for project: 'RESTEasy'
  1. RESTEasy
  2. RESTEASY-3303

Client/WebTarget weirdness when setting Content-Type header


      This change created the following weird-ish behavior:

           .header(HttpHeaders.CONTENT_TYPE, "foo")
           .post(Entity.entity("bar", "text/plain"));

      will send Content-Type: foo. You could argue this is understandable, but I think many will think 'last wins', which is the behavior before the change above. Of course, that policy essentially means you can't use header(String, String) to set the Content-Type when you are submitting an Entity.

      I do think it's debatable what should be done.  I think this is some weirdness with the API.  However, this represents a possible breaking change for us, so need to make sure this was intended behavior that will stay.

      Update: Also, based on a quick glance, I believe the current code works differently if you use the `headers(map)` method.  It will still have the old behavior (i.e. produce `Content-Type: text/plain` in the case above if you use `headers` instead of `header`).

      Added AffectsVersion of 5.0.6.Final as that's where we first noticed it. 

            jperkins-rhn James Perkins
            crankydillo Samuel Cox (Inactive)
            0 Vote for this issue
            2 Start watching this issue