[11.x] Http client: record request when faking connection exception#53530
Merged
taylorotwell merged 3 commits intolaravel:11.xfrom Nov 15, 2024
Merged
Conversation
Merged
1 task
Contributor
|
@gdebrauwer We also need to handle $this->factory?->recordRequestResponsePair($request, null);
/**
* The factory instance.
*
* @var \Illuminate\Http\Client\Factory|null
*/
protected $factory;
In the return $promise->then(function ($response) use ($request, $options) {
$this->factory?->recordRequestResponsePair(
(new Request($request))->withData($options['laravel_data']),
$this->newResponse($response)
);
return $response;
});@taylorotwell tagging you just to ask if it's okay if I raise a PR for this. It's a minor change. |
Contributor
Author
|
@StSarc I'm not sure when the $factory property can be null 🤔 I would just create the PR with the minor change and see what Taylor thinks about it (I don't think he gets a notification on a comment in merged pr) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
I added support for faking a connection exception in a test (see #53485), but I noticed that the request was not being recorded. That means asserting how many requests were sent is currently not correct. This PR fixes that.