users@jersey.java.net

[Jersey] Re: Jersey 2.x accepts requests with unspecified content type and empty body.

From: Ted M. Young [_at_jitterted] <tedyoung_at_gmail.com>
Date: Fri, 20 Sep 2013 10:41:34 -0700

I tried your Gist and I get the expected 415 Unsupported Media Type when I
do an empty POST with no content type specified. When I add the
Content-Type: application/json, it calls the method, also as expected. How
are you testing this?

;ted
--
http://about.me/tedmyoung
On Fri, Sep 20, 2013 at 8:01 AM, <TheCuriousOne_at_centrum.cz> wrote:
> Hi, this might be a bug (or I might be doing something wrong), but Jersey
> accepts requests where the content type is not specified (even though the
> resource is annotated with @Consumes(MediaType.APPLICATION_JSON)) and whose
> body is empty (even though the resource expects non-empty JSON body). Here
> is a minimal example (replace "_" with "/" in the file names, compile using
> "mvn clean install exec:java"):
> https://gist.github.com/anonymous/8c0426646c334cecda50
>
> Cheers,
> P.
>