Skip to content

Commit

Permalink
raise syntax error for unexpected args
Browse files Browse the repository at this point in the history
  • Loading branch information
VishnuSanal committed Sep 1, 2024
1 parent ac74906 commit 271ed0c
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions robyn/router.py
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,12 @@ def wrapped_handler(*args, **kwargs):

name_filtered_params = {k: v for k, v in request_components.items() if k in handler_params and k not in type_filtered_params}

filtered_params = dict(**type_filtered_params, **name_filtered_params)

if len(filtered_params) != len(handler_params):
invalid_args = set(handler_params) - set(filtered_params)
raise SyntaxError(f"Unexpected request params found: ${invalid_args}")

return handler(**dict(**type_filtered_params, **name_filtered_params))

@wraps(handler)
Expand Down

0 comments on commit 271ed0c

Please sign in to comment.