Expect Header
Table of Content
- Syntax
- Directives
- Examples
- Browser Compatibility
- How to modify Expect header
The Expect header is used in HTTP communication to inform the server that certain requirements must be met by the server's response. Its most typical application is in the
100-continue
expectation, where the client informs the server it expects a100 Continue
status code before sending the body of the request. This feature is mainly beneficial when uploading large bodies of data, since it allows clients to avoid losing time transmitting big amounts of data if the server is going to reject the request anyway.
Syntax
Expect: 100-continue
Directives
The Expect header only supports one directive: 100-continue
. This directive prompts the server to validate request headers and send a 100 Continue
status code before processing of the request body begins.
Examples
An example of using the Expect header:
POST /upload HTTP/1.1
Expect: 100-continue
Content-Type: image/jpg
Content-Length: [Length of the body]
Browser Compatibility
Browser | Compatibility |
---|---|
Chrome | Not Supported |
Firefox | Not Supported |
Safari | Not Supported |
Opera | Not Supported |
Edge | Partially Supported |
How to modify Expect header
ModHeader is a browser extension for Google Chrome that allows modification and manipulation of HTTP request headers, and can modify the Expect header as well. To use ModHeader, open the extension and click 'Add'. In the 'Request header name' field, enter 'Expect'. In the 'Request header value' field, enter '100-continue'. This tells the server that the client expects a 100 Continue
response from the server before sending the body of the request.
But please note that the Expect header is not widely supported and the functionality you see may vary across different servers and in different environments. Also, consider the fact that most browsers, except Edge, do not support the Expect header.