Search code examples
httpclientstatus

HTTP status code for 'Loading'


A server receives a request, but decides that the request will take to long to process, so it responds with a site saying Loading.... The site will refresh itself until the client receives the response indicating that the (first) request has been completely processed.

What's the most appropriate status code for this Loading... site?

My guess is that it is 202 Accepted.


Solution

  • HTTP is a request/response protocol. Each request returns a single response.

    In your example, the initial request successfully returns your loading page, and so the "success" 200 code is appropriate.

    Your example of this page then generating further data is working at a different layer to HTTP, and so doesn't need to add semantics to the HTTP level