Skip to content
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

[BUG] Handler functions with same path but different http method can't use different path variable names #1145

Open
Marclev78 opened this issue May 1, 2024 · 0 comments

Comments

@Marclev78
Copy link

Marclev78 commented May 1, 2024

Given two handler functions:

This works fine:

@router.get(path='/{category_slug}', response=CategorySchema)
def get_category(request, category_slug: str):

@router.delete(path='/{category_slug}', response={204: None})
def deactivate_category(request, category_slug: str)

But this doesn't and results in a 405 error when calling the delete handler:

@router.get(path='/{category_slug}', response=CategorySchema)
def get_category(request, category_slug: str):


@router.delete(path='/{slug}', response={204: None})
def deactivate_category(request, category_slug: str)

The only difference is that in the second example, I renamed the path variable to slug instead of category_slug for the delete handler.

@Marclev78 Marclev78 changed the title Handler functions with same path but different http method can't use different path variable names [BUG] Handler functions with same path but different http method can't use different path variable names May 2, 2024
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

No branches or pull requests

1 participant