Dear Forum,
Using a classical Java HTTP client library (Jersey), I get a 404 status sent back to me when sending a HEAD request to the URL https://classroom.github.com/a/mgecjMoT. The URL corresponds to an assignment that exists. A GET request returns the expected 200 status.
Using curl yields the expected 200 status, for both HEAD (-I) and GET requests.
Why does GitHub classroom return a 404 status in some cases for a HEAD request on a URL that exists? Could anyone investigate?
Here is the Java code, for the readers who would wonder.
Invocation.Builder request = ClientBuilder.newClient().target(“https://classroom.github.com/a/mgecjMoT”).request();
LOGGER.info(“Requesting.”);
LOGGER.info(“Using GET: {}.”, request.get());
LOGGER.info(“Using HEAD: {}.”, request.head());
And the result is as follows.
00:17:10.187 [main] INFO i.g.o.check_links_from_source.App - Requesting.
00:17:37.004 [main] INFO i.g.o.check_links_from_source.App - Using GET: InboundJaxrsResponse{context=ClientResponse{method=GET, uri=https://classroom.github.com/a/mgecjMoT, status=200, reason=OK}}.
00:17:48.815 [main] INFO i.g.o.check_links_from_source.App - Using HEAD: InboundJaxrsResponse{context=ClientResponse{method=HEAD, uri=https://classroom.github.com/a/mgecjMoT, status=404, reason=Not Found}}.
Same behavior when changing the user agent used by the client to “curl” or to “curl/7.55.1”.
2 posts - 1 participant