httphttp-gethttp-status-codeshttp-methodhttp-head

Should HEAD's response status code be the same as GET's status code?


As I know, HEAD is the same as GET, but without response body. If I request resource that doesn't exist, GET will response with 404 Not Found. What status code should return HEAD request in this case? 200 OK or 404 Not Found?


Solution

  • As you said yourself, the response should be the same except there is no body.

    This means that both the status and headers need to be the same as they would be for a GET request.