When I call the following code:
Response response = target.request(MediaType.APPLICATION_JSON_TYPE) .post(Entity.entity(form, MediaType.APPLICATION_FORM_URLENCODED_TYPE)); response.getEntity();
response.getEntity () is always null.
But when I call:
JsonObject json = target.request(MediaType.APPLICATION_JSON_TYPE) .post(Entity.entity(form, MediaType.APPLICATION_FORM_URLENCODED_TYPE), JsonObject.class);
variable json is not null.
I need to use the first option, because I need to check the status of the response.
Why does the first code not work? And how can I get a status code?
source share