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

Versioning not applied to RedirectResponse #61

Open
JorenVanSeveren-IPG opened this issue Nov 3, 2021 · 0 comments
Open

Versioning not applied to RedirectResponse #61

JorenVanSeveren-IPG opened this issue Nov 3, 2021 · 0 comments

Comments

@JorenVanSeveren-IPG
Copy link

Describe the bug
A clear and concise description of what the bug is.

When redirecting from a versioned route to another I'd expect the same version to be prefixed, but that's not happening.
As a fallback I'd expect a way to fetch the current version, but there seems to be no easy way to do that (I guess I can fetch it from current path, but doesn't seem clean).

To Reproduce
Steps to reproduce the behavior:

@version(1, 0)
@app.post("/original_route")
async def original_route():

    return "test"

@version(1, 0)
@app.post("/route_alias")
async def redirect_search_ads():

    return RedirectResponse(
        '/original_route', 
        status_code=status.HTTP_302_FOUND)


app = VersionedFastAPI(app,
    version_format='{major}.{minor}',
    prefix_format='/v{major}.{minor}')

Expected behavior
Redirect from /v1.0/route_alias to /v1.0/original_route instead of to /original_route

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