Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

HTTP Request Middleware to log Requests after Global Middleware #1

Merged
merged 5 commits into from
Nov 9, 2023

Conversation

pascalbaljet
Copy link
Contributor

This PR adds a static HttpClientLogger::addRequestMiddleware() method to register an HTTP Request Middleware. This way, you can add the logging after your custom Global Middleware:

use Illuminate\Support\Facades\Http;
use Onlime\LaravelHttpClientGlobalLogger\HttpClientLogger;

Http::globalRequestMiddleware(fn ($request) => $request->withHeader(
    'User-Agent', 'My Custom User Agent'
));

HttpClientLogger::addRequestMiddleware();

@pascalbaljet pascalbaljet changed the title Added a HTTP Request Middleware to log Requests after Global Middleware HTTP Request Middleware to log Requests after Global Middleware Nov 8, 2023
@onlime onlime self-assigned this Nov 8, 2023
@onlime onlime added the enhancement New feature or request label Nov 8, 2023
@onlime onlime merged commit b1fa228 into onlime:main Nov 9, 2023
@onlime
Copy link
Owner

onlime commented Nov 9, 2023

👏 Thanks @pascalbaljet for the great work!

linking the loosely related PRs here (getting Saloon playing nicely with Laravel's HTTP Client Global Middleware):

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants