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

REST Client does not allow GET requests with a body

XMLWordPrintable

    • Icon: Feature Request Feature Request
    • Resolution: Unresolved
    • Icon: Major Major
    • None
    • None
    • jaxrs
    • None
    • Undefined

      REST Client does not allow GET requests with a body, failing with:

       

      Caused by: javax.ws.rs.ProcessingException: RESTEASY004655: Unable to invoke request: javax.ws.rs.ProcessingException: RESTEASY004565: A GET request cannot have a body.
        at org.jboss.resteasy.client.jaxrs.engines.ManualClosingApacheHttpClient43Engine.invoke(ManualClosingApacheHttpClient43Engine.java:287)
        at org.jboss.resteasy.client.jaxrs.internal.ClientInvocation.invoke(ClientInvocation.java:488)
        at org.jboss.resteasy.client.jaxrs.internal.ClientInvocation.invoke(ClientInvocation.java:65)
        at org.jboss.resteasy.client.jaxrs.internal.ClientInvocationBuilder.method(ClientInvocationBuilder.java:322)

      As per RFC 7231

       

      A payload within a GET request message has no defined semantics; sending a payload body on a GET request might cause some existing implementations to reject the request.

      Hence the RFC admits that a GET request may have a body. In my opinion, the Client implementation should therefore not prevent it artificially. Curiously, there is no problem to make a JAX-RS endpoint which accepts a GET request with a body… so it is then surprising that the JAX-RS Client can't send such a request.

       

        1. Main.java
          0.6 kB
        2. pom.xml
          1 kB
        3. xResteasy2824-test-code.zip
          2 kB

              jperkins-rhn James Perkins
              petr.dolezal Petr Doležal (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              5 Start watching this issue

                Created:
                Updated: