Expect HTTP request header indicates expectations that need to be fulfilled by the server in order to properly handle the request.
The only expectation defined in the specification is
Expect: 100-continue, to which the server shall respond with:
100if the information contained in the header is sufficient to cause an immediate success,
417(Expectation Failed) if it cannot meet the expectation; or any other 4xx status otherwise.
For example, the server may reject a request if its
Content-Length is too large.
No common browsers send the
Expect header, but some other clients such as cURL do so by default.
|Header type||Request header|
|Forbidden header name||no|
No other expectations except "100-continue" are specified currently.
- Informs recipients that the client is about to send a (presumably large) message body in this request and wishes to receive a
100(Continue) interim response.
Large message body
A client sends a request with a Expect header and waits for the server to respond before sending the message body.
PUT /somewhere/fun HTTP/1.1 Host: origin.example.com Content-Type: video/h264 Content-Length: 1234567890987 Expect: 100-continue
The server now checks the request headers and may respond with a
100 (Continue) response to instruct the client to go ahead and send the message body, or it will send a
417 (Expectation Failed) status if any of the expectations cannot be met.
|RFC 7231, section 5.1.1: Expect||Hypertext Transfer Protocol (HTTP/1.1): Semantics and Content|
No common browsers are known to send this header.