Closed omerts closed 3 years ago
Hey,
I run into this trying to add CORS support, and the browser is sending an OPTIONS request. I have a path called "/storage"
Seems like routes will never match due to the following: Index.js line number 140:
if (url.length > 1 && url.endsWith("/")) url = url.slice(0, -1);
Which removes any trailing slashes from the url
On the other hand line 1267:
route.path = addSlashes(globalPath) + (opts.path || "");
Meaning it always adds a trailing slash to the end of the route
So line 169, will never be true:
if (url.startsWith(route.path)) {
As url will never have a trailing slash, while route.path will always have one.
Thanks for the report! Please make a test repository with this bug to reproduce it.
Hey,
I run into this trying to add CORS support, and the browser is sending an OPTIONS request. I have a path called "/storage"
Seems like routes will never match due to the following: Index.js line number 140:
Which removes any trailing slashes from the url
On the other hand line 1267:
Meaning it always adds a trailing slash to the end of the route
So line 169, will never be true:
As url will never have a trailing slash, while route.path will always have one.