The 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:
100
if 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.
Expect: 100-continue
100
(Continue) interim response.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.
Specification | Title |
---|---|
RFC 7231, section 5.1.1: Expect | Hypertext Transfer Protocol (HTTP/1.1): Semantics and Content |
Desktop | ||||||
---|---|---|---|---|---|---|
Chrome | Edge | Firefox | Internet Explorer | Opera | Safari | |
Basic support | ? | ? | ? | ? | ? | ? |
Mobile | |||||||
---|---|---|---|---|---|---|---|
Android webview | Chrome for Android | Edge Mobile | Firefox for Android | Opera for Android | iOS Safari | Samsung Internet | |
Basic support | ? | ? | ? | ? | ? | ? | ? |
© 2005–2018 Mozilla Developer Network and individual contributors.
Licensed under the Creative Commons Attribution-ShareAlike License v2.5 or later.
https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Expect