Skip to content

params overrides query string in url #652

@j178

Description

@j178

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:

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?

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions