users@jax-rs-spec.java.net

[jax-rs-spec users] Why no WebApplicationException in JAX-RS client post(), only for post(x,y)?

From: <chammers_at_netcologne.de>
Date: Mon, 12 Oct 2015 14:53:45 +0000 (UTC)

Hello

When using JAX-RS client calls with e.g.
        target.path("...").request().post(obj, String.class);
a WebApplicationException is thrown if the HTTP status code of the
result does
not equal Family.SUCCESSFULL. This is convenient as I don't have to
check
the HTTP result code of every single call myself.

When using just .post(null), because I'm not interested in the result
body, that Exception is not thrown, even if the server replies with
"500 internal error"!
See
https://java.net/projects/jax-rs-spec/sources/api/content/jaxrs-api/src
/main/java/javax/ws/rs/client/SyncInvoker.java?rev=9c5b403aa537ceea7ddd
33533c00f6ff83f6e4ef

What is the rationale for this?

best regards

-christian-