From 28032d35d3fa3f8a1964c7e9d303e4ea7a0f8dee Mon Sep 17 00:00:00 2001 From: Ahmed Alaa <92916738+AhmedAlaa4611@users.noreply.github.com> Date: Mon, 23 Jun 2025 14:43:49 +0300 Subject: [PATCH] Fix order of sections in HTTP Client docs --- http-client.md | 42 +++++++++++++++++++++--------------------- 1 file changed, 21 insertions(+), 21 deletions(-) diff --git a/http-client.md b/http-client.md index ca42e16d186..8235b97a7bd 100644 --- a/http-client.md +++ b/http-client.md @@ -701,27 +701,6 @@ Http::fake(function (Request $request) { }); ``` - -### Preventing Stray Requests - -If you would like to ensure that all requests sent via the HTTP client have been faked throughout your individual test or complete test suite, you can call the `preventStrayRequests` method. After calling this method, any requests that do not have a corresponding fake response will throw an exception rather than making the actual HTTP request: - -```php -use Illuminate\Support\Facades\Http; - -Http::preventStrayRequests(); - -Http::fake([ - 'github.com/*' => Http::response('ok'), -]); - -// An "ok" response is returned... -Http::get('https://github.com/laravel/framework'); - -// An exception is thrown... -Http::get('https://laravel.com'); -``` - ### Inspecting Requests @@ -823,6 +802,27 @@ $recorded = Http::recorded(function (Request $request, Response $response) { }); ``` + +### Preventing Stray Requests + +If you would like to ensure that all requests sent via the HTTP client have been faked throughout your individual test or complete test suite, you can call the `preventStrayRequests` method. After calling this method, any requests that do not have a corresponding fake response will throw an exception rather than making the actual HTTP request: + +```php +use Illuminate\Support\Facades\Http; + +Http::preventStrayRequests(); + +Http::fake([ + 'github.com/*' => Http::response('ok'), +]); + +// An "ok" response is returned... +Http::get('https://github.com/laravel/framework'); + +// An exception is thrown... +Http::get('https://laravel.com'); +``` + ## Events