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

Authenticated routes with different method but same path causes conflict. #982

Open
Rohithzr opened this issue Oct 13, 2024 · 2 comments · May be fixed by #987
Open

Authenticated routes with different method but same path causes conflict. #982

Rohithzr opened this issue Oct 13, 2024 · 2 comments · May be fixed by #987
Labels
bug Something isn't working

Comments

@Rohithzr
Copy link

Bug Description

Authenticated Routes with different methods but same path throw the following error.

thread '<unnamed>' panicked at src/server.rs:347:14:
called `Result::unwrap()` on an `Err` value: insertion failed due to conflict with previously registered route: /auth/v1/profile

Expectation:
The routes with same path but different methods should work without error.

Complete file: https://github.com/Rohithzr/robyn-template/blob/main/standalone.py
Sample code:

@app.get("/health")
async def health():
    return {"status": "ok"}

@app.post("/health")
async def health_alt():
    return {"status": "ok"}

@app.get("/auth/v1/login")
async def login(request):
    return {"status": "ok"}

@app.get("/auth/v1/logout")
async def logout(request):
    return {"status": "ok"}

@app.get("/auth/v1/callback")
async def callback(request):
    return {"status": "ok"}

@app.get("/auth/v1/profile", auth_required=True)
async def get_profile(request):
    return {"status": "ok"}

@app.post("/auth/v1/profile", auth_required=True)
async def create_profile(request):
    return {"status": "ok"}

@app.patch("/auth/v1/profile", auth_required=True)
async def update_profile(request):
    return {"status": "ok"}
Screenshot_2024-10-12_at_2 08 07_PM

Steps to Reproduce

You can run this source file - https://github.com/Rohithzr/robyn-template/blob/main/standalone.py

git clone https://github.com/Rohithzr/robyn-template
pip install robyn
python standalone.py

Your operating system

MacOS

Your Python version (python --version)

3.11

Your Robyn version

latest

Additional Info

No response

@Rohithzr Rohithzr added the bug Something isn't working label Oct 13, 2024
@Rohithzr Rohithzr changed the title Authenticated routes with different method but same path throw error. Authenticated routes with different method but same path causes conflict. Oct 13, 2024
@sansyrox
Copy link
Member

Thanks for opening this @Rohithzr 😄

I will have a look soon 👍

@sansyrox
Copy link
Member

@VishnuSanal , could you have a look at this?

VishnuSanal added a commit to VishnuSanal/Robyn that referenced this issue Oct 18, 2024
@VishnuSanal VishnuSanal linked a pull request Oct 18, 2024 that will close this issue
6 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants