Skip to content
Myr

params argument on URL should merge, not replace. (#653)

Before adoption: this commit came in with the history the project adopted, so no landing records it.

authored by Tom Christie · committed by GitHub · parent 5ee512d · Browse files · 2 files+8 added−3 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

2 files+8 added−3 removed

  • tests:+1 added−1 removed
  • other:+7 added−2 removed

2 files+8 added−3 removed

modified:httpx/models.py+7 added-2 removed
88 unmodified lines
89 # Normalize scheme and domain name.90 if self.is_absolute_url:91 self._uri_reference = self._uri_reference.normalize()9293 # Add any query parameters.93 # Add any query parameters, merging with any in the URL if needed.94 if params:95 if self._uri_reference.query:96 url_params = QueryParams(self._uri_reference.query)97 url_params.update(params)98 query_string = str(url_params)99 else:95 query_string = str(QueryParams(params))100 query_string = str(QueryParams(params))101 self._uri_reference = self._uri_reference.copy_with(query=query_string)102103 # Enforce absolute URLs by default.104 if not allow_relative:
1017 unmodified lines
modified:tests/models/test_url.py+1 added-1 removed
87 unmodified lines
88 url = URL("https://example.org:123/path/to/somewhere", params={"a": "123"})89 assert str(url) == "https://example.org:123/path/to/somewhere?a=123"9091 url = URL("https://example.org:123/path/to/somewhere?b=456", params={"a": "123"})92 assert str(url) == "https://example.org:123/path/to/somewhere?a=123"92 assert str(url) == "https://example.org:123/path/to/somewhere?b=456&a=123"939495def test_url_join():96 """
109 unmodified lines