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

fix: allowedMethods() should not fail if more than one router is defined #183

Merged
merged 1 commit into from
Sep 12, 2024

Conversation

lbesson-della
Copy link
Contributor

@lbesson-della lbesson-della commented Aug 19, 2024

Fixes #182

Checklist

  • I have ensured my pull request is not behind the main or master branch of the original repository.
  • I have rebased all commits where necessary so that reviewing this pull request can be done without having to merge it first.
  • I have written a commit message that passes commitlint linting.
  • I have ensured that my code changes pass linting tests.
  • I have ensured that my code changes pass unit tests.
  • I have described my pull request and the reasons for code changes along with context if necessary.

@lukpsaxo
Copy link

We have this issue too, would be great to get merged

@zhaoyuqiqi
Copy link

You can use “koa-router”, it works

@lbesson-della
Copy link
Contributor Author

The npm package "koa-router" is on version 12.0.1

This bug concerns version 13.0.0 (which is the latest version published for npm package @koa/router)

@mnahkies
Copy link

We just ran into issues with this as well.

In our case we hit the issue when a 404 occurred due to an incorrect url being constructed by a client, but instead of a helpful 404 response/log we got an internal server error with the Cannot read properties of undefined (reading 'length') message from above (note: the stack trace was also hopeless, didn't mention koa router at all).

This made it take longer to diagnose the actual issue than it would've otherwise.

It would be great to get this merged - I've tested the fix from this PR on our issue, and it appears to fix it.

@3imed-jaberi 3imed-jaberi merged commit 76020dd into koajs:master Sep 12, 2024
3 checks passed
@lbesson-della lbesson-della deleted the patch-1 branch September 13, 2024 07:05
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.

[fix] allowedMethods will fail if two routes are defined
5 participants