zrhoffman commented on code in PR #4074:
URL: https://github.com/apache/trafficcontrol/pull/4074#discussion_r1014437701
##########
traffic_router/core/src/test/java/org/apache/traffic_control/traffic_router/core/external/LocationsTest.java:
##########
@@ -139,4 +144,38 @@ public void itGetsCachesForALocation() throws Exception {
if (response != null) response.close();
}
}
+
+ @Test
+ public void itHandlesHeadRequests() throws Exception {
+ final List<String> paths = new ArrayList<String>();
+ paths.add("http://localhost:3333/crs/locations");
+ paths.add("http://localhost:3333/crs/locations/caches");
+
+ CloseableHttpResponse response = null;
+
+ try {
+ final HttpGet httpGet = new
HttpGet("http://localhost:3333/crs/locations");
+ response = closeableHttpClient.execute(httpGet);
+
+ ObjectMapper objectMapper = new ObjectMapper(new
JsonFactory());
+ JsonNode jsonNode =
objectMapper.readTree(EntityUtils.toString(response.getEntity()));
+
+ String location =
jsonNode.get("locations").get(0).asText();
+ paths.add("http://localhost:3333/crs/locations/" +
location + "/caches");
+ } catch (Exception e) {
+ fail(e.getMessage());
+ } finally {
+ if (response != null) response.close();
+ }
+
+ for (final String path : paths) {
+ final HttpHead httpHead = new HttpHead(path);
+ try {
+ response =
closeableHttpClient.execute(httpHead);
+
assertThat(response.getStatusLine().getStatusCode(), equalTo(200));
Review Comment:
Checking that it sets the Content-Length header in 81bc50d2d0
--
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]