Skip to content

Test client does not handle urls containing fragments correctly #363

Closed as not planned
@petrstefanueni

Description

Urls containing a fragment identifier e.g. /some-page#section are not handled correctly by the test client. This applies both if given as an argument (like in the example below) and when following a redirect response.

from quart import Quart
app = Quart(__name__)

@app.route('/')
async def hello():
    return 'hello'


async def test_get(app):
    client = app.test_client()
    response = await client.get('/')
    assert response.status_code == 200


async def test_get_with_fragment(app):
    client = app.test_client()
    response = await client.get('/#something')
    # status code is 404, so this fails
    assert response.status_code == 200

The second test fails because the returned status code is 404. The expected behavior is for both tests to pass.

Environment:

  • Python version: 3.12.7
  • Quart version: 0.19.6

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions