Skip to content

If params=... is passed then replace any existing query parameters, rather than merge them. #2713

@lovelydinosaur

Description

@lovelydinosaur

Prompted by #2712 (comment).

Currently when the URL contains existing query parameters and the params=... argument is passed, we merge the sets of query parameters...

>>> httpx.Request('GET', 'http://example.com?a=1', params={'b': '2'})
<Request('GET', 'http://example.com?a=1&b=2')>

This seems a bit counter-intuitive to me - I'd probably(?) expect them to be replaced, rather than merged.

Is it worth us changing this behaviour?

Implemented here...

self.url = self.url.copy_merge_params(params=params)

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