supertokens / supertokens-node

Node SDK for SuperTokens core
https://supertokens.com
Other
292 stars 79 forks source link

fix: Prefer exact api path match in the middleware #892

Closed anku255 closed 2 months ago

anku255 commented 2 months ago

Summary of change

The API request path may or may not include the tenantId. The returnAPIIdIfCanHandleRequest function handles both the cases. Currently, the middleware function simply calls the first recipe it matches. However, there is a chance that other recipes may have an exact match.

This PR updates the middlware such that we prefer an exact match.

Related issues

Test Plan

(Write your test plan here. If you changed any code, please provide us with clear instructions on how you verified your changes work. Bonus points for screenshots and videos!)

Documentation changes

(If relevant, please create a PR in our docs repo, or create a checklist here highlighting the necessary changes)

Checklist for important updates