dsmiley commented on code in PR #3262:
URL: https://github.com/apache/solr/pull/3262#discussion_r1999537597
##########
solr/core/src/test/org/apache/solr/handler/V2ApiIntegrationTest.java:
##########
@@ -139,6 +144,52 @@ public void testWTParam() throws Exception {
assertEquals(respString, 0, Utils.getObjectByPath(resp, true,
"/responseHeader/status"));
}
+ @Test
+ public void testObeysWtParameterWhenProvided() throws Exception {
+ final var httpClient = getRawClient();
+ final var listCollRequest = getListCollectionsRequest();
+ listCollRequest.setURI(
+ new URIBuilder(listCollRequest.getURI()).addParameter("wt",
"xml").build());
+
+ final var response = httpClient.execute(listCollRequest);
+
+ assertEquals(200, response.getStatusLine().getStatusCode());
+ assertEquals("application/xml",
response.getFirstHeader("Content-type").getValue());
+ }
+
+ @Test
+ public void testObeysAcceptHeaderWhenWtParamNotProvided() throws Exception {
+ final var httpClient = getRawClient();
+ final var listCollRequest = getListCollectionsRequest();
+ listCollRequest.addHeader("Accept", "application/xml");
+
+ final var response = httpClient.execute(listCollRequest);
+
+ assertEquals(200, response.getStatusLine().getStatusCode());
+ assertEquals("application/xml",
response.getFirstHeader("Content-type").getValue());
+ }
+
+ @Test
+ public void testRespondsWithJsonWhenWtAndAcceptAreMissing() throws Exception
{
+ final var httpClient = getRawClient();
+ final var listCollRequest = getListCollectionsRequest();
+
+ final var response = httpClient.execute(listCollRequest);
+
+ assertEquals(200, response.getStatusLine().getStatusCode());
+ assertEquals("application/json",
response.getFirstHeader("Content-type").getValue());
+ }
+
+ private HttpClient getRawClient() {
+ return ((CloudLegacySolrClient) cluster.getSolrClient()).getHttpClient();
+ }
Review Comment:
We're trying to get away from Apache HttpClient. Can you please try Jetty
HttpClient instead?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]