:expect plugin enables sending the
expect: 100-continue header on all requests that contain a request body (POST, PATCH…).
httpx already supported the flow when the user would pass the header manually, however, this plugin adds the following features on top of it:
Expectheader if the server responds with
417 Expectation Failed.
:expect_timeoutoption (default: 2) if no
100 Continueresponse is received (similar to what
You can set how long (in seconds) you want to wait for the
100 Continue response before sending the body.
When set, it means: the byte size threshold until which the
expect: 100-continue header won’t be sent. This option is here if some requests are so small that using
expect: 100-continue only generates needless round-trips, but you’d still like to enable it when uploading files.
HTTPX.plugin(:expect, expect_timeout: 10).post("https://example.com")
Next: Rate Limiter