Skip to content

Commit

Permalink
Merge pull request #2936 from jamezp/RESTEASY-2997-3.15
Browse files Browse the repository at this point in the history
[RESTEASY-2997] Remove the message from a client response which could…
  • Loading branch information
jamezp authored Oct 21, 2021
2 parents f056b85 + 97bd4c9 commit c4ee349
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 14 deletions.
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package org.jboss.resteasy.core;

import org.jboss.resteasy.resteasy_jaxrs.i18n.LogMessages;
import org.jboss.resteasy.specimpl.BuiltResponse;
import org.jboss.resteasy.spi.ApplicationException;
import org.jboss.resteasy.spi.Failure;
import org.jboss.resteasy.spi.HttpRequest;
Expand Down Expand Up @@ -181,17 +180,6 @@ protected Response handleClientErrorException(Response response, final String me

if (response != null)
{
BuiltResponse bResponse = (BuiltResponse)response;
if (bResponse.getStatus() == HttpResponseCodes.SC_BAD_REQUEST
|| bResponse.getStatus() == HttpResponseCodes.SC_NOT_FOUND)
{
if (message != null)
{
Response.ResponseBuilder builder = bResponse.fromResponse(response);
builder.type(MediaType.TEXT_HTML).entity(message);
return builder.build();
}
}
return response;

} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ public void testNotFound() throws Exception {
Response response = target.request().get();
String entity = response.readEntity(String.class);
Assert.assertEquals("ResponseFilter was probably not applied to response", HttpResponseCodes.SC_NOT_FOUND * 2, response.getStatus());
Assert.assertTrue("Wrong body of response", entity.startsWith("RESTEASY003210"));
Assert.assertTrue("Wrong body of response", entity.isEmpty());
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ public void testIllegalArgumentException() {
header("Content-Type", MediaType.APPLICATION_FORM_URLENCODED).post(null);
Assert.assertEquals(response.getStatus(), Response.Status.BAD_REQUEST.getStatusCode());
String entity = response.readEntity(String.class);
Assert.assertTrue(ERROR_CODE, entity.contains("RESTEASY003870"));
Assert.assertTrue(ERROR_CODE, entity.isEmpty());
response.close();
}

Expand Down

0 comments on commit c4ee349

Please sign in to comment.