Skip to content

Navigation Menu

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

[12.X] Fix Http::preventStrayRequests error propagation when using Http::pool #55689

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

Conversation

LeTamanoir
Copy link
Contributor

When testing code that uses Http::pool via the Http::fake and Http::preventStrayRequests the error won't be propagated correctly, for example if you forget to fake a path you will get this kind of error:

Illuminate\Http\Client\PendingRequest::{closure:Illuminate\Http\Client\PendingRequest::makePromise():994}(): Argument #1 ($e) must be of type OutOfBoundsException|GuzzleHttp\Exception\TransferException, RuntimeException given, called in /[REDACTED]/vendor/guzzlehttp/promises/src/RejectedPromise.php on line 49

with the changes I propose you should get the following:

Attempted request to [your/route/...] without a matching fake.

@LeTamanoir LeTamanoir marked this pull request as draft May 9, 2025 11:19
@LeTamanoir LeTamanoir marked this pull request as ready for review May 9, 2025 11:50
@LeTamanoir
Copy link
Contributor Author

I was not sure if I should have stayed with the RuntimeException + adding a regex check for the error message content in the PendingRequest callback.

Changing the exception class might be breaking for some strange code out there in the wild haha,
but considering it still inherits RuntimeException and Http::fake is only meant for testing I guess it's fine...

WDYT guys ?

@taylorotwell taylorotwell merged commit 76cee6b into laravel:12.x May 9, 2025
58 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants
Morty Proxy This is a proxified and sanitized view of the page, visit original site.