apichallenges > solutions > head-todos-200

How to complete the challenge HEAD /todos (200)

How to issue a HEAD request and see the results of a GET request without the body of the response, this can be useful for checking the existence of an item when automating.

HEAD /todos (200)

Issue a HEAD request on the /todos end point

  • HEAD request is basically a GET but doesn't return the body
  • Use it to 'ping' an end point and see if it exists, or to check the Headers are working correctly
  • Usually returns a 200 (if it exists) or a 404 (if it doesn't exist)

Basic Instructions

  • Issue a HEAD request to end point "/todos"
    • http://apichallenges.eviltester.com/todos
  • The request should have an X-CHALLENGER header to track challenge completion
  • The response status code should be 200 because the end point exists
  • Compare the response with the response from GET /todos

Example Request

> HEAD /todos HTTP/1.1
> Host: apichallenges.eviltester.com
> User-Agent: rest-client
> X-CHALLENGER: x-challenger-guid
> Accept: */*

Example Response

< HTTP/1.1 200 OK
< Connection: keep-alive
< Date: Thu, 27 Aug 2020 14:09:19 GMT
< Content-Type: application/json
< X-Challenger: x-challenger-guid
< Server: Jetty(9.4.z-SNAPSHOT)
< Via: 1.1 vegur

Overview Video

Watch on YouTube: "Solution to HEAD specific Todo endpoint"

Patreon ad free version