Skip to content

Commit 46c1347

Browse files
Fix order of sections in HTTP Client docs (#10524)
1 parent c74eeb1 commit 46c1347

File tree

1 file changed

+21
-21
lines changed

1 file changed

+21
-21
lines changed

http-client.md

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -701,27 +701,6 @@ Http::fake(function (Request $request) {
701701
});
702702
```
703703

704-
<a name="preventing-stray-requests"></a>
705-
### Preventing Stray Requests
706-
707-
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:
708-
709-
```php
710-
use Illuminate\Support\Facades\Http;
711-
712-
Http::preventStrayRequests();
713-
714-
Http::fake([
715-
'github.com/*' => Http::response('ok'),
716-
]);
717-
718-
// An "ok" response is returned...
719-
Http::get('https://github.com/laravel/framework');
720-
721-
// An exception is thrown...
722-
Http::get('https://laravel.com');
723-
```
724-
725704
<a name="inspecting-requests"></a>
726705
### Inspecting Requests
727706

@@ -823,6 +802,27 @@ $recorded = Http::recorded(function (Request $request, Response $response) {
823802
});
824803
```
825804

805+
<a name="preventing-stray-requests"></a>
806+
### Preventing Stray Requests
807+
808+
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:
809+
810+
```php
811+
use Illuminate\Support\Facades\Http;
812+
813+
Http::preventStrayRequests();
814+
815+
Http::fake([
816+
'github.com/*' => Http::response('ok'),
817+
]);
818+
819+
// An "ok" response is returned...
820+
Http::get('https://github.com/laravel/framework');
821+
822+
// An exception is thrown...
823+
Http::get('https://laravel.com');
824+
```
825+
826826
<a name="events"></a>
827827
## Events
828828

0 commit comments

Comments
 (0)