Skip to content

Commit

Permalink
[RESTEASY-3205] Change Content-Type to text/plain for Security filter
Browse files Browse the repository at this point in the history
  • Loading branch information
The-Huginn authored and jamezp committed Feb 7, 2024
1 parent 5e1680e commit bb97b08
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ public void filter(ContainerRequestContext requestContext) throws IOException {
return;
}
throw new ForbiddenException(Response.status(403).entity("Access forbidden: role not allowed")
.type("text/html;charset=UTF-8").build());
.type("text/plain;charset=UTF-8").build());
}
}
return;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -273,7 +273,7 @@ public void testAccesForbiddenMessage() throws Exception {
public void testContentTypeWithForbiddenMessage() {
Response response = unauthorizedClient.target(generateURL("/secured/denyWithContentType")).request().get();
Assert.assertEquals(HttpResponseCodes.SC_FORBIDDEN, response.getStatus());
Assert.assertEquals("Incorrect Content-type header", "text/html;charset=UTF-8",
Assert.assertEquals("Incorrect Content-type header", "text/plain;charset=UTF-8",
response.getHeaderString("Content-type"));
Assert.assertEquals("Missing forbidden message in the response", ACCESS_FORBIDDEN_MESSAGE,
response.readEntity(String.class));
Expand Down

0 comments on commit bb97b08

Please sign in to comment.