[ 
https://issues.apache.org/jira/browse/CXF-2560?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12782933#action_12782933
 ] 

Roman Kalukiewicz commented on CXF-2560:
----------------------------------------

I have such code:

Response response = WebClient.create("http://localhost:1235/";)
                        .accept("*/*")
                        .path("/path/not-exist")
                        .get();
Assert.assertEquals(Status.NOT_FOUND.getStatusCode(), response.getStatus());

// Due to the bug in WebClient response.getEntity() returns null, and it is 
impossible
// to retrieve message.
// Assert.assertThat(response.getEntity().toString(), 
JUnitMatchers.containsString("not found"));

BTW I see, that the payload is sent via HTTP protocol back to the client.

> WebClient doesns't read response body if status code means some error
> ---------------------------------------------------------------------
>
>                 Key: CXF-2560
>                 URL: https://issues.apache.org/jira/browse/CXF-2560
>             Project: CXF
>          Issue Type: Bug
>          Components: JAX-RS
>    Affects Versions: 2.2.5
>            Reporter: Roman Kalukiewicz
>
> In {{org.apache.cxf.jaxrs.client.AbstractClient.readBody(Response, 
> HttpURLConnection, Message, Class<?>, Type, Annotation[])}} there is a 
> conddition that causes {{WebClient}} not to read the content of the response 
> if status code describes some kind of error.
> I believe that if some response is sent by the server I should be able to 
> read it even if the status is for example 404.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to