Re: Method annotated with @GET questions
Jean-Louis Monteiro <[email protected]>
| Newsgroups | gmane.comp.java.openejb.user |
|---|---|
| Message-ID | <CAPkio3EHSKxwxtQUKnguNRETW0ZWjLenRum2qXZzEmiGZjJ7Fg@mail.gmail.com> |
First your understanding is aligned with mine. Sending payloads with the GET method is discouraged but not forbidden. I have seen some cases in my career. Now concretely with TomEE, I'd need to double check CXF resolution. This piece of code is a bit complex, but I would not be surprised if it would ignore the content-type as it's not expecting any content. -- Jean-Louis Monteiro http://twitter.com/jlouismonteiro http://www.tomitribe.com On Fri, Mar 17, 2023 at 11:47 AM COURTAULT Francois <[email protected]> wrote: > Hello everyone, > > Is it relevant to annotate a @GET method with @Consumes knowing that it's > not advised to have a payload for HTTP GET request even if it is not > forbidden by the specification if I have well understood ? > > I ask this question because I have performed some tests with TomEE 8.0.14 > and I am a little bit surprised. > Indeed I have annotated an @GET method with @Consumes ( { > MediaType.TEXT_PLAIN}). > Then I sent a GET request using curl with a Content-Type set to > application/json. > I was expecting to get a 415 but in fact everything worked fine. > > Does it means that there is no check between the Content-Type value and > the @Consumes media types for HTTP GET methods ? > meaning that @Consumes for HTTP GET methods is useless ? > > Best Regards. > > > >