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

Run middleware before the custom handler if one exists #3530

Merged
merged 2 commits into from
May 28, 2021

Conversation

ryanhall07
Copy link
Collaborator

Previously if a custom handler was registered to override an existing
handler, the middleware would still run before the existing handler.

custom -> middleware fns -> previous

Now the middleware is not added until after the custom handlers override
any previous handlers. This ensures the middleware always runs first.

  1. If a custom handler overrides a previous handler

middleware fns -> custom -> previous

  1. If a custom handler does not override anything

middleware fns -> custom

  1. If there is no custom handler for the route

middleware fn -> previous

What this PR does / why we need it:

Fixes #

Special notes for your reviewer:

Does this PR introduce a user-facing and/or backwards incompatible change?:


Does this PR require updating code package or user-facing documentation?:


Copy link
Collaborator

@robskillington robskillington left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Previously if a custom handler was registered to override an existing
handler, the middleware would still run before the existing handler.

custom -> middleware fns -> previous

Now the middleware is not added until after the custom handlers override
any previous handlers. This ensures the middleware always runs first.

1. If a custom handler overrides a previous handler

middleware fns -> custom -> previous

2. If a custom handler does not override anything

middleware fns -> custom

3. If there is no custom handler for the route

middleware fn -> previous
@wesleyk wesleyk enabled auto-merge (squash) May 28, 2021 20:22
@wesleyk wesleyk merged commit 08c2e55 into master May 28, 2021
@wesleyk wesleyk deleted the rhall-middleware-custom branch May 28, 2021 20:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants