HTTP headers | Expect

The HTTP headers Expect request-header field is used to indicate specific behaviors or expectations that the server needs to fulfill in order to respond to the client. Generally, Expect: 100-continue is the only expectation defined for the header field. If the data provided in the header field meets the expectation value, then the server responds with 100 indicating that it is a success, else it responds with status 417 specifying that the expectation has failed. The reason behind putting the Expect, that would be to work around broken web servers.

Syntax:

Expect: 100-continue

Directives:



  • 100-continue: It means that the server has received the request header and in order to send the request body, the server must respond with status 100 to the client.

Note: There is no need to put a blank header if you are not going to put any Expect clause.

Example:

PUT /demo/program HTTP/1.1
Host: original.sample.com
Content-Type: video/h264
Content-Length: 2342564178765
Expect: 100-continue

The server now goes through the request headers and either responds with 100 indicating the client to send the request body or return status 417 if the expectations are not met.

Supported Browsers: The browsers compatibility for HTTP headers Expect is unknown right now.



My Personal Notes arrow_drop_up

Check out this Author's contributed articles.

If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to contribute@geeksforgeeks.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.

Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.




Article Tags :

Be the First to upvote.


Please write to us at contribute@geeksforgeeks.org to report any issue with the above content.