Note: introduced in
:expect plugin enables sending the
Expect: 100-continue header on all requests that typically have 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.
You can set how long (in seconds) you want to wait for the
100 Continue response before sending the body. This is similar to what cURL does in such cases.
When set, it means: the byte size threshold until which the
Expect header won’t be sent. This option is here if your requests are so small that using
Expect only adds latency, however, you’d like to enable it when uploading big files.
HTTPX.plugin(:expect, expect_timeout: 10).post(....
Next: Rate Limiter