cdnjs / api-server

📡 API server for api.cdnjs.com - The #1 free and open source CDN built to make life easier for developers.
https://api.cdnjs.com
MIT License
89 stars 38 forks source link

https://api.cdnjs.com/libraries/?search=boo return 404 #81

Closed yumusb closed 1 year ago

yumusb commented 2 years ago

After this commit https://github.com/cdnjs/api-server/commit/a66a3fb7e4308d23ab5ebaf7af3fb9c81baced47 (I'm not sure) https://api.cdnjs.com/libraries/?search=boo will return 404, but many proj use this route to search , I think new commit should be compatible with this route to ensure that no one else makes code changes to there proj. https://github.com/cdnjs/api-server/blob/e625736355d02764bc688759ac480ad06343e1df/src/routes/libraries.js#L69

MattIPv4 commented 2 years ago

:wave: Thanks for flagging this -- It looks like we've never officially tested, supported or documented support for routes with a trailing slash.

That being said, I suspect that Express may have done some route normalisation in the background that doesn't happen with Hono, and so a silent regression has occurred.

The best fix here would be to add route normalisation to our new Hono code, and also update the test suite to explicitly test the trailing slash versions of our routes :)