instantcommerce/next-api-decorators

Dynamic Routes don't Match Sub-Routes when the Parameter Value Contains Hyphens

tpjnorton opened this issue ยท 6 comments

Describe the bug

Basically, when we're using an API route at something like pages/api/posts/[slug]/meta:

If the value of slug contains hyphens, e.g. my-first-post, then any sub-routes (like meta in this case) no longer match

To Reproduce
Steps to reproduce the behavior:

  1. Create an API route at pages/api/posts/[slug]/meta with a simple GET handler.
  2. Try sending a request when the value of slug is 'help-me'
  3. You get "Cannot GET /api/lessons/help-me/meta"
  4. Note: if you change this to helpme, the route matches.

Expected behavior
A route should match.

Hi @tn12787

Thanks for the bug report! Just released a fix in the beta channel.

Let me know the outcome.

Thanks so much! I'll give it a go and report back :)

๐ŸŽ‰ This issue has been resolved in version 1.7.2-beta.2 ๐ŸŽ‰

The release is available on:

Your semantic-release bot ๐Ÿ“ฆ๐Ÿš€

Looks fixed! Think we can close this :)

Thanks for the speedy fix!

๐ŸŽ‰ This issue has been resolved in version 1.7.3 ๐ŸŽ‰

The release is available on:

Your semantic-release bot ๐Ÿ“ฆ๐Ÿš€