Skip to content

Versioning not applied to RedirectResponse #61

@JorenVanSeveren-IPG

Description

@JorenVanSeveren-IPG

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions