amphp / http-client

An advanced async HTTP client library for PHP, enabling efficient, non-blocking, and concurrent requests and responses.
https://amphp.org/http-client
MIT License
706 stars 66 forks source link

Add inactivity timeout to SetRequestTimeout interceptor #362

Closed Nek- closed 5 months ago

Nek- commented 7 months ago

I figured out that the inactivity timeout was not present in the default interceptor in charge of updating the timeouts.

Of course it's not a big deal and here is a workaround:

$this->httpClient = (new HttpClientBuilder)
    ->interceptNetwork(
        new ModifyRequest(static function (Request $request) {
            $request->setInactivityTimeout(500);

            return $request;
        })
    )
    ->build();

But I decided maybe it's a good first contribution here 😄 . I also updated a bit the documentation because it was missing in the interceptor list! However, I'm sorry I don't know how to fix the test.

trowski commented 6 months ago

Thanks! It looks like the test you added is failing due to a mis-matched message. Could you take a look at that?

Nek- commented 6 months ago

Oops. Sorry, it was late! 😂

Fixed it! 🙏

kelunik commented 5 months ago

Thanks!