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

Improve path checking before route registration #155

Merged
merged 5 commits into from
Jul 4, 2022

Conversation

peterver
Copy link
Contributor

@peterver peterver commented Jun 30, 2022

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.

fixes: #147, #148

@peterver
Copy link
Contributor Author

@wengeezhang @etroynov kindly review once you find some time in your busy schedules

@etroynov
Copy link
Contributor

@3imed-jaberi @niftylettuce can you review it?

test/lib/router.js Outdated Show resolved Hide resolved
test/lib/router.js Outdated Show resolved Hide resolved
@etroynov
Copy link
Contributor

etroynov commented Jun 30, 2022

I also recommend you change the title, because someone may not understand that PR is about a specific issue.

It could be something like:
Improve path checking before route registration

and add in description:
fix for issue #147 - it will link your PR with this issue

p.s thx for your help.

@etroynov etroynov mentioned this pull request Jun 30, 2022
@peterver peterver changed the title Feature/147 Improve path checking before route registration Jun 30, 2022
@peterver
Copy link
Contributor Author

peterver commented Jun 30, 2022

I also recommend you change the title, because someone may not understand that PR is about a specific issue.

It could be something like: Improve path checking before route registration

and add in description: fix for issue #147 - it will link your PR with this issue

p.s thx for your help.

@etroynov should be done, I've also improved on the verb specific test by running it against all methods exported in the methods module used by the router, let me know if you agree with that approach. Ps: No worries, happy to help :)

Copy link

@SagnikPradhan SagnikPradhan left a comment

Choose a reason for hiding this comment

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

You could probably move those checks to a function isValidPath instead but otherwise looks alright. 👍🏻

@titanism titanism merged commit 6aca720 into koajs:master Jul 4, 2022
@titanism
Copy link
Contributor

titanism commented Jul 4, 2022

We have just published @koajs/router v11.0.0 which resolves this issue. This is mirrored to koa-router as well.

https://github.com/koajs/router/releases/tag/v11.0.0

This project is maintained by Forward Email and Lad.

@peterver
Copy link
Contributor Author

peterver commented Jul 4, 2022

You could probably move those checks to a function isValidPath instead but otherwise looks alright. 👍🏻

@SagnikPradhan Agree :). I'll take a look either tonight or tomorrow to move those bits into utility functions, there's some other parts of the validation which could use some abstraction to ensure code readability, of course I'll write some tests for any PR I open, thanks for the tip :).

@peterver
Copy link
Contributor Author

peterver commented Jul 4, 2022

We have just published @koajs/router v11.0.0 which resolves this issue. This is mirrored to koa-router as well.

https://github.com/koajs/router/releases/tag/v11.0.0

This project is maintained by Forward Email and Lad.

@titanism awesome! I'll regularly check in and chip in where possible, we're heavy users of koa and koa-router and would want to help maintain :)

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.

better to check path before register
4 participants