Skip to content

Commit 7e31f27

Browse files
[10.x]: Updated Http fake method callback signature to include options array (#10000)
* [10.x]: Updated Http `fake` method callback signature to include options array Sometimes we need to access the PendingRequest options like the timeout value in a test case, hopefully this could save someone else time in the future * Update http-client.md --------- Co-authored-by: Taylor Otwell <taylor@laravel.com>
1 parent f05a413 commit 7e31f27

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

http-client.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -548,11 +548,11 @@ If you would like to fake a sequence of responses but do not need to specify a s
548548
<a name="fake-callback"></a>
549549
#### Fake Callback
550550

551-
If you require more complicated logic to determine what responses to return for certain endpoints, you may pass a closure to the `fake` method. This closure will receive an instance of `Illuminate\Http\Client\Request` and should return a response instance. Within your closure, you may perform whatever logic is necessary to determine what type of response to return:
551+
If you require more complicated logic to determine what responses to return for certain endpoints, you may pass a closure to the `fake` method. This closure will receive an instance of `Illuminate\Http\Client\Request` as well as an array of options. The closure should return a response instance. Within your closure, you may perform whatever logic is necessary to determine what type of response to return:
552552

553553
use Illuminate\Http\Client\Request;
554554

555-
Http::fake(function (Request $request) {
555+
Http::fake(function (Request $request, array $options) {
556556
return Http::response('Hello World', 200);
557557
});
558558

0 commit comments

Comments
 (0)