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

[HttpClient] Ability to add middlewares #32367

Open
flaver12 opened this issue Jul 4, 2019 · 0 comments

Comments

Projects
None yet
2 participants
@flaver12
Copy link

commented Jul 4, 2019

It would be nice to have the ability to add middlewares to the request.
I came up with this because I had the case that I use an API to get projects.
The API has a request limit, after that, it sends back a 429. In this case, it would be nice to have the ability to add a middleware that can react to that.
Or in other cases where if you have a certain header to do something with it before it comes to the actual logic.

<?php
$middlewares = Middlewares::create();
$middlewares->push($instanceOfMyMiddleware);
$this->client->request('GET', 'https://my-example-api.com/endpoint', ['middlewares' => $middlewares]);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.