-
Notifications
You must be signed in to change notification settings - Fork 0
safe route params
github-actions[bot] edited this page Apr 7, 2024
·
5 revisions
💼 This rule is enabled in the following configs: 🌐 all
, ✅ recommended
.
💡 This rule is manually fixable by editor suggestions.
❌ Incorrect code:
@Controller("user")
class UserController {
@Get("route/:id")
getRouteById(@Param("invalid") invalid: string) {}
notARoute(@Param("id") id: string) {}
}
✅ Corrrect code:
@Controller("user")
class UserController {
@Get("route/:id")
getRouteById(@Param("id") invalid: string) {}
notARoute(id: string) {}
// OR
@Post("route/:id")
notARoute(@Param("id") id: string) {}
}