-
-
Notifications
You must be signed in to change notification settings - Fork 362
Fix/aot strictpath default #1459
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
WalkthroughThe strictPath guard in src/index.ts was broadened from equality false to a general falsy check, affecting when loose and encoded loose paths are registered. A new test file was added to validate strictPath behavior across AOT and grouped routes. Changes
Sequence Diagram(s)sequenceDiagram
autonumber
participant Client
participant Router
participant Handler
Client->>Router: HTTP request (path)
alt strictPath is truthy
Router->>Router: Match exact path only
else strictPath is falsy (false/undefined/null)
Router->>Router: Register/match loose and encoded loose variants
end
Router->>Handler: Invoke matched route
Handler-->>Client: Response (200 or 404)
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Poem
Pre-merge checks and finishing touches✅ Passed checks (3 passed)
✨ Finishing touches
🧪 Generate unit tests (beta)
📜 Recent review detailsConfiguration used: CodeRabbit UI Review profile: CHILL Plan: Pro 📒 Files selected for processing (2)
🔇 Additional comments (2)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Changed strictPath check from ===false to !this.config.strictPath to properly handle undefined default, fixing trailing slash 404s when aot:false is set without explicit strictPath config.
6cf3548
to
f6aceb1
Compare
@coderabbitai review |
✅ Actions performedReview triggered.
|
Description
Fixes strictPath default behavior when
aot: false
is set. This solves #1458The Bug
When you set
aot: false
without explicitly specifyingstrictPath
,routes behave as if
strictPath: true
is enabled. This causes paths withtrailing slashes to return 404.
Example:
Returns 404, should be 200
Root Cause
Line 812 in src/index.ts uses strict equality:
When strictPath is undefined (the default), undefined === false evaluates
to false, so loose path variants never get added to the dynamic router.
The Fix
Changed to truthy check:
This matches the pattern used elsewhere in the codebase (lines 1024, 1042,
1048, and compose.ts:2271).
Tests
Added test/core/aot-strictpath.test.ts covering:
Summary by CodeRabbit