Skip to content

100 Continue

Description

The 100 Continue status code is an informational HTTP response status that indicates the server has received the initial part of the request and the client should proceed with the request or ignore the response if the request has already been completed.

This status code is particularly useful in scenarios where the client needs to send a large request body but wants to check if the server is willing to accept the request before transmitting the entire payload. By sending an Expect: 100-continue header in the request, the client indicates it's waiting for this interim response before proceeding.

The 100 Continue status helps optimize network resources by preventing clients from sending large amounts of data that might be rejected by the server due to authentication requirements, content restrictions, or other conditions that can be determined from the request headers alone.

Syntax

The server responds with a 100 Continue status before the final response:

HTTP/1.1 100 Continue

[empty line]

After receiving this interim response, the client proceeds to send the request body. Once the complete request is processed, the server sends the final response with an appropriate status code (such as 200 OK, 201 Created, etc.).

Examples

Basic Example

A client wants to upload a large file but first checks if the server will accept it:

Client Request (initial headers only):

POST /upload HTTP/1.1
Host: example.com
Content-Type: application/octet-stream
Content-Length: 15000000
Expect: 100-continue

Server Interim Response:

HTTP/1.1 100 Continue

After receiving this response, the client proceeds to send the request body:

Client Request (continued with body):

[15MB of binary data]

Server Final Response:

HTTP/1.1 201 Created
Location: /files/uploaded-file
Content-Type: application/json
Content-Length: 42

{"status": "success", "fileId": "12345abcde"}

Example with Rejection

If the server decides not to accept the request based on the headers:

Client Request (initial headers only):

POST /upload HTTP/1.1
Host: example.com
Content-Type: application/octet-stream
Content-Length: 15000000
Expect: 100-continue
Authorization: Bearer invalid-token

Server Response (rejection without 100 Continue):

HTTP/1.1 401 Unauthorized
Content-Type: application/json
Content-Length: 67

{"error": "Authentication failed", "message": "Invalid token provided"}

In this case, the client saves bandwidth by not sending the 15MB payload.

Summary

The 100 Continue status code serves as an efficiency mechanism in HTTP communications, allowing clients to verify that a server will accept a request before sending large payloads. This optimization is particularly valuable in bandwidth-constrained environments or when dealing with large file uploads. The client initiates this process by including the Expect: 100-continue header, and the server responds with 100 Continue if it's willing to process the complete request.