-
Notifications
You must be signed in to change notification settings - Fork 11.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[10.x] Fix Http global middleware for queue, octane, and dependecy in…
…jection (#47915) * Ensure global middleware is shared across Octane requests and queued jobs * Rename import * Update FoundationServiceProvider.php --------- Co-authored-by: Taylor Otwell <[email protected]>
- Loading branch information
1 parent
872b086
commit 4e0716b
Showing
2 changed files
with
26 additions
and
0 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
<?php | ||
|
||
namespace Illuminate\Tests\Integration\Http; | ||
|
||
use Illuminate\Http\Client\Factory; | ||
use Illuminate\Support\Facades\Facade; | ||
use Illuminate\Support\Facades\Http; | ||
use Orchestra\Testbench\TestCase; | ||
|
||
class HttpClientTest extends TestCase | ||
{ | ||
public function testGlobalMiddlewarePersistsAfterFacadeFlush(): void | ||
{ | ||
Http::macro('getGlobalMiddleware', fn () => $this->globalMiddleware); | ||
Http::globalRequestMiddleware(fn ($request) => $request->withHeader('User-Agent', 'Example Application/1.0')); | ||
Http::globalRequestMiddleware(fn ($request) => $request->withHeader('User-Agent', 'Example Application/1.0')); | ||
|
||
$this->assertCount(2, Http::getGlobalMiddleware()); | ||
|
||
Facade::clearResolvedInstances(); | ||
|
||
$this->assertCount(2, Http::getGlobalMiddleware()); | ||
} | ||
} |