From 8560e4a392962f6b1bdd40f444f091f6a36cdbd4 Mon Sep 17 00:00:00 2001 From: Jacek Kowalski <Jacek@jacekk.info> Date: Fri, 24 Nov 2023 15:24:58 +0000 Subject: [PATCH] CASLoginProtocol: close Response resource in backchannelLogout --- src/test/java/org/keycloak/protocol/cas/ContentTypeHelperTest.java | 32 +++++++------------------------- 1 files changed, 7 insertions(+), 25 deletions(-) diff --git a/src/test/java/org/keycloak/protocol/cas/ContentTypeHelperTest.java b/src/test/java/org/keycloak/protocol/cas/ContentTypeHelperTest.java index 9bca8b9..826213f 100644 --- a/src/test/java/org/keycloak/protocol/cas/ContentTypeHelperTest.java +++ b/src/test/java/org/keycloak/protocol/cas/ContentTypeHelperTest.java @@ -13,33 +13,15 @@ public class ContentTypeHelperTest { @Test public void test() throws Exception { - assertEquals(MediaType.APPLICATION_XML_TYPE, get("http://example.com/", null).selectResponseType()); - assertEquals(MediaType.APPLICATION_JSON_TYPE, get("http://example.com/?format=json", null).selectResponseType()); - assertEquals(MediaType.APPLICATION_XML_TYPE, get("http://example.com/?format=xml", null).selectResponseType()); - assertEquals(MediaType.APPLICATION_JSON_TYPE, get("http://example.com/?format=JSON", null).selectResponseType()); - assertEquals(MediaType.APPLICATION_XML_TYPE, get("http://example.com/?format=XML", null).selectResponseType()); - - assertEquals(MediaType.APPLICATION_XML_TYPE, get("http://example.com/", MediaType.APPLICATION_XML).selectResponseType()); - assertEquals(MediaType.APPLICATION_JSON_TYPE, get("http://example.com/?format=json", MediaType.APPLICATION_XML).selectResponseType()); - assertEquals(MediaType.APPLICATION_XML_TYPE, get("http://example.com/?format=xml", MediaType.APPLICATION_XML).selectResponseType()); - - assertEquals(MediaType.APPLICATION_JSON_TYPE, get("http://example.com/", MediaType.APPLICATION_JSON).selectResponseType()); - assertEquals(MediaType.APPLICATION_JSON_TYPE, get("http://example.com/?format=json", MediaType.APPLICATION_JSON).selectResponseType()); - assertEquals(MediaType.APPLICATION_XML_TYPE, get("http://example.com/?format=xml", MediaType.APPLICATION_JSON).selectResponseType()); - - assertEquals(MediaType.APPLICATION_XML_TYPE, get("http://example.com/", MediaType.TEXT_PLAIN).selectResponseType()); - assertEquals(MediaType.APPLICATION_XML_TYPE, get("http://example.com/", "text/html, image/gif, image/jpeg, *; q=.2, */*; q=.2").selectResponseType()); + assertEquals(MediaType.APPLICATION_XML_TYPE, get("http://example.com/").selectResponseType()); + assertEquals(MediaType.APPLICATION_JSON_TYPE, get("http://example.com/?format=json").selectResponseType()); + assertEquals(MediaType.APPLICATION_XML_TYPE, get("http://example.com/?format=xml").selectResponseType()); + assertEquals(MediaType.APPLICATION_JSON_TYPE, get("http://example.com/?format=JSON").selectResponseType()); + assertEquals(MediaType.APPLICATION_XML_TYPE, get("http://example.com/?format=XML").selectResponseType()); } - private ContentTypeHelper get(String uri, String acceptHeader) throws Exception { + private ContentTypeHelper get(String uri) throws Exception { MockHttpRequest req = MockHttpRequest.get(uri); - MockHttpResponse res = new MockHttpResponse(); - RequestImpl restReq = new RequestImpl(req, res); - - if (acceptHeader != null) { - req = req.header(HttpHeaders.ACCEPT, acceptHeader); - } - - return new ContentTypeHelper(req, restReq, req.getUri()); + return new ContentTypeHelper(req.getUri()); } } -- Gitblit v1.9.1