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

[BUG] Using multiple instances of the middleware with different rules is not possible #39

Open
Nicolai- opened this issue Nov 29, 2023 · 0 comments
Assignees
Labels
Milestone

Comments

@Nicolai-
Copy link
Contributor

Detailed description

With the new feature implemented in #33 which we appreciate being implemented! :)
I expected to solve our use case by adding 2 instances of the Middleware, but that does not work.

Ex.
Instance 1 ( We wan't to retry on all 429 no matter the method):

GuzzleRetryMiddleware::factory([
    'retry_on_status' => ['429']
])

Instance 2 (Retry on all GET requests for another set of response codes):

GuzzleRetryMiddleware::factory([
    'retry_on_methods' => ['GET'],
    'retry_on_status' => ['500', '503', '504']
])

The issue(from what I can tell) is that the "combined" options created as the first thing inside __invoke from the middleware is provided to $next (the second middleware), which then overwrites the default options (The second set of rules for the other middleware).

@caseyamcl caseyamcl self-assigned this Nov 30, 2023
@caseyamcl caseyamcl added the bug label Nov 30, 2023
@caseyamcl caseyamcl added this to the v3.0 milestone Jun 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants