Understanding 100 Continue - HTTP Status Code

Anchal Rastogi
6 min read | Published on : May 03, 2024
Last Updated on : Jul 30, 2024





Table of Contents

What is a 100 Status Code?

HTTP status codes are crucial indicators that web servers use to communicate with clients about the result of their request. The 100 Continue status code is one of them. When a client sends a request to the server, the server may respond with a 100 Continue status code to indicate that the initial part of the request has been received and understood, and the client should continue with the request or ignore it if it has already been completed.

Catch HTTP Network errors proactively with Zipy. Sign up for free!

Try Zipy now

What Are the Possible Use Cases for 100 Status Code?

  1. Large Data Uploads: When a client is uploading a large file or data to the server, the server might send a 100 Continue response to indicate readiness to receive the rest of the data.
  2. Expect-Continue Header Handling: The 100 Continue status code is often used in conjunction with the Expect header. If a client sends a request with the Expect: 100-continue header, the server may respond with 100 Continue before the client sends the request body, based on its criteria.

How to Implement 100 Status Code in JavaScript

Implementing the 100 Continue status code in JavaScript requires understanding how to handle HTTP requests and responses. Below is a simple example using the fetch API:

fetch('<https://example.com/resource>', {
  method: 'POST',
  headers: {
    'Content-Type': 'application/json',
    'Expect': '100-continue'
  },
  body: JSON.stringify(data)
}).then(response => {
  if (response.status === 100) {
    // Continue with the request
    return response.json();
  } else {
    // Handle other status codes
    throw new Error('Unexpected status code: ' + response.status);
  }
}).then(data => {
  // Handle response data
}).catch(error => {
  // Handle errors
});

Best Practices for Using 100 Status Code

  1. Use it Responsibly: Only use the 100 Continue status code when it's applicable, such as during large data uploads or when the server needs to signal readiness.
  2. Understand Client and Server Behavior: Both client and server need to understand and correctly handle the 100 Continue status code. Ensure compatibility and proper behavior on both ends.

How to Test 100 Status Code on Postman

Testing the 100 Continue status code in Postman is straightforward:

  1. Create a new request in Postman.
  2. Set up the request headers, including Expect: 100-continue if necessary.
  3. Send the request to the server.
  4. Check the response. If the server supports 100 Continue, it should respond with the status code 100.

How to Test 100 Status Code in DevTools Browser in Chrome

Testing the 100 Continue status code in Chrome DevTools involves:

  1. Open Chrome DevTools.
  2. Navigate to the Network tab.
  3. Send a request to the server with the appropriate headers.
  4. Check the response headers in the Network tab. Look for the presence of HTTP/1.1 100 Continue in the response headers.

Debug and fix API errors with Zipy Error Monitoring.

Sign up for free

Frequently Asked Questions

Q: When should I use the 100 Continue status code?

A: Use the 100 Continue status code when the server needs to indicate readiness to receive the rest of the request body, typically in scenarios involving large data uploads.

Q: Is the 100 Continue status code mandatory?

A: No, it's not mandatory. Its usage depends on the server's implementation and the specific requirements of the application.

Q: Can the client ignore the 100 Continue response?

A: Yes, the client can ignore the 100 Continue response and proceed with sending the request body anyway.

Q: How does the server decide when to send a 100 Continue response?

A: The server decides based on its internal logic and any criteria specified in the request headers, such as the Expect header.

Q: Are there any drawbacks to using the 100 Continue status code?

A: One potential drawback is increased complexity in handling requests and responses, especially for applications dealing with large volumes of data.

Conclusion

Understanding the 100 Continue HTTP status code is crucial for efficient communication between clients and servers, especially in scenarios involving large data transfers. By implementing best practices and testing methodologies, developers can ensure smooth handling of requests and responses. For advanced error monitoring and handling capabilities, consider using Zipy's tool with session replay functionality.

Read more resources on 1xx status codes

Wanna try Zipy?

Zipy provides you with full customer visibility without multiple back and forths between Customers, Customer Support and your Engineering teams.

The unified digital experience platform to drive growth with Product Analytics, Error Tracking, and Session Replay in one.

product hunt logo
G2 logoGDPR certificationSOC 2 Type 2
Zipy is GDPR and SOC2 Type II Compliant
© 2024 Zipy Inc. | All rights reserved
with
by folks just like you