api-server icon indicating copy to clipboard operation
api-server copied to clipboard

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

Open yumusb opened this issue 1 year ago • 1 comments

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

yumusb avatar Aug 28 '22 00:08 yumusb

: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 :)

MattIPv4 avatar Aug 28 '22 00:08 MattIPv4