Skip to content

fix: default pathOptional to '/' when deregistering root optional params#423

Open
deepview-autofix wants to merge 1 commit into
delvedor:mainfrom
deepview-autofix:deepview/a841e0d7d3
Open

fix: default pathOptional to '/' when deregistering root optional params#423
deepview-autofix wants to merge 1 commit into
delvedor:mainfrom
deepview-autofix:deepview/a841e0d7d3

Conversation

@deepview-autofix
Copy link
Copy Markdown

The off method replaced the optional parameter in the path but did not fall back to '/' when the resulting string was empty, unlike on. For paths like /:param?, off threw "The path could not be empty" instead of removing the route registered at '/'.

The `off` method replaced the optional parameter in the path but did
not fall back to '/' when the resulting string was empty, unlike `on`.
For paths like `/:param?`, `off` threw "The path could not be empty"
instead of removing the route registered at '/'.

Co-Authored-By: Claude <noreply@anthropic.com>
Co-Authored-By: DeepView Autofix <276251120+deepview-autofix@users.noreply.github.com>
Co-Authored-By: Nikita Skovoroda <chalkerx@gmail.com>
Signed-off-by: Nikita Skovoroda <chalkerx@gmail.com>
Copy link
Copy Markdown

@ChALkeR ChALkeR left a comment

Choose a reason for hiding this comment

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

the test was throwing on findMyWay.off('GET', '/:optional?') before the fix

Copy link
Copy Markdown
Collaborator

@mcollina mcollina left a comment

Choose a reason for hiding this comment

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

lgtm

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.

3 participants