1xx Status Codes (Informational)
Types of HTTP Status Codes
Before moving on to 1xx status codes, it is best to know that there are five categories into which we can divide HTTP response codes.
- 1xx Status Codes for information.
- 2xx Status Codes indicate that a request has been processed properly.
- 3xx Status Codes for redirection advise the client that the requested resource is accessible elsewhere on the server.
- 4xx Status Codes for client errors primarily comes from the browser, because the required parameters to visit the requested URL are lacking.
- 5xx Status Codes for Server Errors indicate that the request could not be processed.
Introduction
Browsers and user agents will not decode and display 1xx HTTP codes on the frontend screen, as they are only intended for informational purposes. These status codes are disregarded by browsers, and they carry on with processing the rest of the requests.
100 Continue Status Code
The 100 Continue status code indicates that the server has received the first portion of the request and that the client should continue with the request or disregard the response if it has already been completed.
The client can just disregard this interim response if the request didn't have an Expect header field with the 100-continue expectation.
References for Code 100
- HTTP Status Symbol for Rails
:continue
- HTTP Status Constant for Python2
httplib.CONTINUE
- HTTP Status Constant for Go
http.StatusContinue
- HTTP Status Constant for Python3+
http.client.CONTINUE
- HTTP Status Constant for Python3.5+
http.HTTPStatus.CONTINUE
- HTTP Status Constant for Symfony
Response::HTTP_CONTINUE
101 Switching Protocols Status Code
After the empty line that ends the 101 response, the server MUST create an Upgrade header field in the response that specifies which protocol(s) will be used going forward.
It is believed that the server will only consent to changing protocols when doing so is advantageous. For instance, upgrading to a more recent version of HTTP may be preferable to older versions, and migrating to a real-time, synchronous protocol may be beneficial when sending resources that make use of such characteristics.
References for Code 101
- HTTP Status Symbol for Rails
:switching_protocols
- HTTP Status Constant for Python2
httplib.SWITCHING_PROTOCOLS
- HTTP Status Constant for Python3+
http.client.SWITCHING_PROTOCOLS
- HTTP Status Constant for Symfony
Response::HTTP_SWITCHING_PROTOCOLS
- HTTP Status Constant for Python3.5+
http.HTTPStatus.SWITCHING_PROTOCOLS
- HTTP Status Constant for Go
http.StatusSwitchingProtocols
102 Processing Status Code
Only when the server reasonably anticipates that the request will take a long time to complete can it send this status code. As a general rule, the server SHOULD return a 102 (Processing) answer if a method is taking more than 20 seconds (a fair, but arbitrary value) to process. Once the request is finished, the server MUST send a final response.
Methods, particularly those that support the Depth header, may take a long time to process. While waiting for a response, the client may time out the connection under such circumstances. To avoid this, the server may send the client a 102 Processing status code to show that it is still processing the method.
References for Code 102
- HTTP Status Symbol for Rails
:processing
- HTTP Status Constant for Symfony
Response::HTTP_PROCESSING
103 Early Hints Status Code
The purpose of the 103 Early hints status code is to let the user agent preload resources while the server constructs a response. It is primarily meant to be used with the Link Header.
Conclusion
A 1xx Informational status code indicates that the request has been received, and the server is executing it. A 1xx status code is only sent temporarily, during the request processing. Since it's not the complete answer to the request, you won't come across these very often in most tasks.