In the log you posted in that Gist, curl is sending
Accept: */*
Which means that it'll accept anything. This is not the same as
"unspecified", which would be *no* Accept header. So, that's still acting
as I would expect. Perhaps I'm not understanding what you're actually
getting vs. what you're expecting?
;ted
On Sat, Sep 21, 2013 at 12:09 AM, <TheCuriousOne_at_centrum.cz> wrote:
> Sure, this is the case when MyResource.foo is called (the server prints
> "MyResource.foo" to stderr) even though it should not be [1]. In case I
> specify the Content-Type, it works as expected (either the request is
> rejected based on the content type or based on the body being malformed
> (even when it's empty)).
>
> [1]: https://gist.github.com/anonymous/1e5c2dd49dc703d9b089
>
> Cheers,
> P.
>
> ______________________________________________________________
> > Od: "Ted M. Young [@jitterted]" <tedyoung_at_gmail.com>
> > Komu: "users_at_jersey.java.net" <users_at_jersey.java.net>
> > Datum: 20.09.2013 19:42
> > Předmět: [Jersey] Re: Jersey 2.x accepts requests with unspecified
> content type and empty body.
> >
> >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.
> >>
> >
>