| | |
| | | package org.keycloak.protocol.cas; |
| | | |
| | | import jakarta.ws.rs.core.HttpHeaders; |
| | | import jakarta.ws.rs.core.MediaType; |
| | | import org.jboss.resteasy.mock.MockHttpRequest; |
| | | import org.jboss.resteasy.mock.MockHttpResponse; |
| | | import org.jboss.resteasy.specimpl.RequestImpl; |
| | | import org.junit.Test; |
| | | import org.keycloak.protocol.cas.utils.ContentTypeHelper; |
| | | |
| | | import javax.ws.rs.core.HttpHeaders; |
| | | import javax.ws.rs.core.MediaType; |
| | | |
| | | import static org.junit.Assert.assertEquals; |
| | | |
| | |
| | | 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()); |
| | | } |
| | | |
| | | private ContentTypeHelper get(String uri, String acceptHeader) throws Exception { |