Skip to content

[HttpClient] Ability to add middlewares  #32367

@flaver12

Description

@flaver12

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]);

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      pFad - Phonifier reborn

      Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

      Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


      Alternative Proxies:

      Alternative Proxy

      pFad Proxy

      pFad v3 Proxy

      pFad v4 Proxy