Repository: encode/httpx

Issue:
`params` overrides query string in url
Hi,

I noticed a difference between `httpx` and `requests` when processing query parameters. I provided the `params` for the url with query string, `requests` would **merge** `params` into query string, but `httpx` replaces the whole query string.

Here is a simple script:

```py
import requests
import httpx
import asyncio

URL = 'https://httpbin.org/get?a=1'

r = requests.get(URL, params={'b': 2})
print('requests', r.json()['args'])

async def f():
    r = await httpx.get(URL, params={'b': 2})
    print('httpx', r.json()['args'])
asyncio.run(f())
```

Results:
```
requests {'a': '1', 'b': '2'}
httpx {'b': '2'}
```

Is this an intended behavior?

Discussion:
tomchristie: Running the example in #652 after this change...

```python
$ python ./example.py 
requests {'a': '1', 'b': '2'}
httpx {'a': '1', 'b': '2'}
```

Patch:
diff --git a/httpx/models.py b/httpx/models.py
index ad3599b..fc938c3 100644
--- a/httpx/models.py
+++ b/httpx/models.py
@@ -90,9 +90,14 @@ class URL:
         if self.is_absolute_url:
             self._uri_reference = self._uri_reference.normalize()
 
-        # Add any query parameters.
+        # Add any query parameters, merging with any in the URL if needed.
         if params:
-            query_string = str(QueryParams(params))
+            if self._uri_reference.query:
+                url_params = QueryParams(self._uri_reference.query)
+                url_params.update(params)
+                query_string = str(url_params)
+            else:
+                query_string = str(QueryParams(params))
             self._uri_reference = self._uri_reference.copy_with(query=query_string)
 
         # Enforce absolute URLs by default.


Test patch:
diff --git a/tests/models/test_url.py b/tests/models/test_url.py
index 1415ee9..491d0a4 100644
--- a/tests/models/test_url.py
+++ b/tests/models/test_url.py
@@ -89,7 +89,7 @@ def test_url_params():
     assert str(url) == "https://example.org:123/path/to/somewhere?a=123"
 
     url = URL("https://example.org:123/path/to/somewhere?b=456", params={"a": "123"})
-    assert str(url) == "https://example.org:123/path/to/somewhere?a=123"
+    assert str(url) == "https://example.org:123/path/to/somewhere?b=456&a=123"
 
 
 def test_url_join():