users@jersey.java.net

[Jersey] Re: Jersey2: Impossible to POST with empty entity?

From: Marek Potociar <marek.potociar_at_oracle.com>
Date: Thu, 7 Nov 2013 16:15:15 +0100

I see a conflict between what we as Jersey implementors want (make sure that Jersey client does not produce requests that do not make sense) and what you as a unit test developer want (be as flexible as possible).

Off the top of my head, one solution is to stick to low-level HTTP client libraries for these legal, but non-sense tests. Other solution would be to provide some switch in Jersey (and/or the underlying connectors) that will force Jersey to ignore any validation/correction of these ill requests. Clearly we need some time to think about it and come up with the good resolution. Please feel free to file an improvement request for this.

Marek

On 05 Nov 2013, at 22:26, cowwoc <cowwoc_at_bbs.darktech.org> wrote:

>
> Unit tests. The server might be written in Jersey but I have no guarantee that the client will be. In general, we must be able to test all legal use-cases (even if they are not meaningful) otherwise we have no way of hardening the server against 3rd-party clients.
>
> Thanks,
> Gili
>
> On 05/11/2013 3:49 PM, Marek Potociar wrote:
>> Legal does not necessarily mean meaningful or correct. Why do you want to do it?
>>
>> Marek
>>
>> On 26 Oct 2013, at 22:12, cowwoc <cowwoc_at_bbs.darktech.org> wrote:
>>
>>> Hi,
>>>
>>> I just noticed something funny. It seems to be impossible to send POST requests to a URI:
>>> With a Content-Type but no body
>>> Without either a Content-Type or body
>>> Why is that? I believe both of these use-cases are legal.
>>>
>>> Thanks,
>>> Gili
>>
>