HTTP

Status Code

100 Continue

The server received the request headers and the client should proceed to send the body. Learn when and how to use 100 Continue for efficient large uploads.

5 min read advanced Try in Playground

TL;DR: 100 Continue means the server received your headers and you can send the body. Used for large uploads.

A 100 Continue status code is an informational response that tells the client the server has received the request headers and is ready to accept the request body. Think of it like knocking on a door and getting a “come in” response before you carry in heavy boxes—it prevents wasted effort if the door was going to stay closed anyway.

This status code helps optimize network usage by allowing clients to check if the server will accept their request before transmitting potentially large request bodies.

When Does This Happen?

You’ll see a 100 Continue response in these common situations:

1. Large File Uploads

Client wants to upload 500MB file
→ Sends headers with Expect: 100-continue
→ Server responds 100 Continue
→ Client sends file data

2. API Request Validation

Client preparing to send large JSON payload
→ Server validates auth headers first
→ Responds 100 Continue if authorized
→ Client sends payload

3. Video/Media Streaming

Uploading video content to streaming service
→ Server checks quota/permissions
→ Sends 100 Continue if allowed
→ Client streams video data

4. Database Import

Importing large dataset via HTTP
→ Server validates format in headers
→ Returns 100 Continue if valid
→ Client sends data

5. Form Submission with Attachments

Submitting form with large attachments
→ Server checks session validity
→ Responds 100 Continue
→ Client uploads form data

Example Responses

Successful Continue:

HTTP/1.1 100 Continue


```http

Note: The 100 Continue response typically has no body and is followed by the final response after the request body is received.

**Complete Exchange:**

```http
Client Request (Headers Only):
POST /upload HTTP/1.1
Host: api.example.com
Content-Type: application/octet-stream
Content-Length: 524288000
Expect: 100-continue

Server Response (100 Continue):
HTTP/1.1 100 Continue


Client Sends Body:
[500MB of binary data]

Server Final Response:
HTTP/1.1 201 Created
Location: https://api.example.com/files/12345
Content-Type: application/json

{
  "id": "12345",
  "size": 524288000,
  "status": "uploaded"
}

Rejection Without Continue:

Client Request:
POST /upload HTTP/1.1
Host: api.example.com
Content-Length: 524288000
Expect: 100-continue
Authorization: Bearer invalid_token

Server Response (No 100, Direct Error):
HTTP/1.1 401 Unauthorized
WWW-Authenticate: Bearer realm="api"

{
  "error": "Invalid authentication token"
}
```http

## Real-World Example

Imagine you're uploading a large video file to a content platform:

**Initial Request with Expect Header:**

```http
PUT /api/videos/upload HTTP/1.1
Host: video.example.com
Authorization: Bearer eyJhbGciOiJIUzI1NiIs...
Content-Type: video/mp4
Content-Length: 1073741824
Expect: 100-continue
X-Video-Title: My Tutorial Video
X-Video-Category: education

Server Validates and Responds:

HTTP/1.1 100 Continue


```text

**Client Proceeds to Upload:**

```json
[1GB of video data being transmitted...]
```text

**Final Success Response:**

```http
HTTP/1.1 201 Created
Location: https://video.example.com/videos/vid_abc123
Content-Type: application/json

{
  "video_id": "vid_abc123",
  "status": "processing",
  "size_bytes": 1073741824,
  "estimated_processing_time": "5 minutes"
}

100 vs Other Informational Codes

CodeMeaningUsageClient Action
100Continue sending bodyBefore large uploadsSend request body
101Switching ProtocolsWebSocket upgradesSwitch to new protocol
102Processing (WebDAV)Long operationsWait for final response
103Early HintsPreload resourcesStart loading resources

Important Characteristics

Optional Nature:

Expect: 100-continue  ← Client requests, but server may ignore
```text

- Clients should be prepared to send body even without 100
- Server may skip 100 and send final response directly
- Timeout typically 1-2 seconds before proceeding

**No Response Body:**

```http
HTTP/1.1 100 Continue
                      ← Empty line, no content

Intermediate Response:

  • Not the final HTTP response
  • Followed by actual response after body is received
  • Only sent if client includes Expect: 100-continue

Common Mistakes

❌ Waiting indefinitely for 100

// Bad: Waiting forever
await waitFor100Continue() // Could hang indefinitely
sendBody()
```text

**❌ Sending 100 when not requested**

```http
Client Request (no Expect header):
POST /upload HTTP/1.1

Server Response:
HTTP/1.1 100 Continue  ← Unnecessary, client didn't ask

❌ Sending 100 after receiving body

Client already sent full request with body

Server sends 100 Continue  ← Too late!
```javascript

**✅ Correct usage**

```javascript
// Good: Timeout fallback
const timeout = setTimeout(() => sendBody(), 1000)
response.on('100-continue', () => {
  clearTimeout(timeout)
  sendBody()
})

Best Practices

Use for Large Requests Only:

const shouldUseExpect = contentLength > 1024 * 1024 // 1MB threshold

if (shouldUseExpect) {
  headers['Expect'] = '100-continue'
}
```javascript

**Implement Timeout Logic:**

```javascript
// Wait max 1 second for 100 Continue
const continueTimeout = setTimeout(() => {
  console.log('No 100 Continue received, sending body anyway')
  sendRequestBody()
}, 1000)

client.on('continue', () => {
  clearTimeout(continueTimeout)
  sendRequestBody()
})

Server-Side Validation:

// Validate before sending 100
app.use((req, res, next) => {
  if (req.headers.expect === '100-continue') {
    // Check auth, quotas, etc.
    if (!isAuthorized(req)) {
      return res.status(401).send('Unauthorized')
    }

    if (exceedsQuota(req)) {
      return res.status(413).send('Payload Too Large')
    }

    // Send 100 Continue
    res.writeContinue()
  }
  next()
})
```javascript

## Implementation Examples

**Node.js (Client):**

```javascript
const http = require('http')

const options = {
  hostname: 'api.example.com',
  port: 80,
  path: '/upload',
  method: 'POST',
  headers: {
    'Content-Type': 'application/octet-stream',
    'Content-Length': largeFile.length,
    Expect: '100-continue'
  }
}

const req = http.request(options, (res) => {
  console.log(`Final response: ${res.statusCode}`)
})

req.on('continue', () => {
  console.log('Received 100 Continue, sending body...')
  req.write(largeFile)
  req.end()
})

// Fallback: send after 1 second if no 100
setTimeout(() => {
  if (!req.finished) {
    req.write(largeFile)
    req.end()
  }
}, 1000)

Node.js (Server):

const http = require('http')

const server = http.createServer((req, res) => {
  if (req.headers.expect === '100-continue') {
    // Validate request
    if (req.headers.authorization) {
      res.writeContinue() // Send 100
    } else {
      res.writeHead(401)
      res.end('Unauthorized')
      return
    }
  }

  // Handle the request body
  let body = []
  req.on('data', (chunk) => body.push(chunk))
  req.on('end', () => {
    res.writeHead(200)
    res.end('Upload successful')
  })
})
```javascript

**Python (Requests):**

```python
import requests

headers = {
    'Content-Type': 'application/octet-stream',
    'Expect': '100-continue'
}

# Requests library handles 100-continue automatically
response = requests.post(
    'https://api.example.com/upload',
    headers=headers,
    data=large_file_data
)

Try It Yourself

Visit our request builder and see 100 Continue in action:

  1. Set method to POST
  2. Set path to /upload-demo
  3. Add header: Expect: 100-continue
  4. Add large request body
  5. Click Send request
  6. Watch for 100 Continue before body transmission

Frequently Asked Questions

What does 100 Continue mean?

A 100 Continue response tells the client that the server received the request headers and is ready to accept the request body. It is used with the Expect: 100-continue header for large uploads.

When should I use Expect: 100-continue?

Use it when sending large request bodies. The client sends headers first with Expect: 100-continue, waits for 100 Continue, then sends the body. This avoids uploading large data if the server will reject it.

What happens if the server does not support 100 Continue?

If the server ignores the Expect header, the client should send the body after a timeout. Most HTTP clients handle this automatically. The request will still work, just without the optimization.

Is 100 Continue a final response?

No, 100 is an interim informational response. The server will send a final response (like 200 OK or 201 Created) after processing the complete request with body.

Keep Learning