Thanks to visit codestin.com
Credit goes to github.com

Skip to content

[HttpClient] Fix MockResponse in case of header timeout #53625

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from

Conversation

rmikalkenas
Copy link
Contributor

Q A
Branch? 5.4
Bug fix? yes
New feature? no
Deprecations? no
Issues -
License MIT

In case of header timeout - getStatusCode method should throw TimeoutException. That's the expected behaviour for all http client implementations.

@nicolas-grekas
Copy link
Member

nicolas-grekas commented Jan 25, 2024

Thanks for submitting. Unless I missed something, this removes the possibility to simulate a timeout immediately after headers have been received, isn't it?
I think we're missing a way to express that we want a timeout during the request.
Here is an alternative idea: what about allowing it using the "error" info?

new MockResponse('abc', ['error' => new TimeoutException()]);

This would define a response that'd behave as if a timeout were reached while sending the request, and that'd resume with the body if the timeout exception is dealt with (by streaming the response again).

This would be a new feature of course.

@nicolas-grekas
Copy link
Member

Closing as explained, thanks for submitting.
Feel free to follow up with my proposal if it makes sense to you :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants