Skip to content

Corruption of query parameter value when using base_url with query string #3614

@Starmania

Description

@Starmania

But it became a real problem if you try to set a query parameter within the base_url.

Test case:

import httpx

client = httpx.Client(base_url="https://httpbingo.org/get?data=1")
print(client.base_url.query)

response = client.get("")
print(response.json()["args"])

Expected output (as data is clearly defined as a query parameter)

b'data=1'
{'data': ['1']}

Other valid output (dropping query parameters)

b''
{}

Actual output

b'data=1/'
{'data': ['1/']}

Metadata

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