Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

qs and query in request_history are converted to lowercase #264

Open
ferenc-hechler opened this issue Sep 15, 2024 · 1 comment
Open

qs and query in request_history are converted to lowercase #264

ferenc-hechler opened this issue Sep 15, 2024 · 1 comment

Comments

@ferenc-hechler
Copy link

ferenc-hechler commented Sep 15, 2024

In a text-callback for GET I used request.qs to get the original parameters as dict.
But all keys and values are converted to lowercase.

this bug seems to exist since a long time and it was fixed 2016 in the openstack version.

https://bugs.launchpad.net/requests-mock/+bug/1584008

As a workaround I used

from urllib import parse
...
def text_callback(request, context):
    qs = parse.parse_qs(parse.urlparse(request.url).query)
@vandoragroup
Copy link

Looks like the problem originates here:

if not self._case_sensitive:
url = url.lower()

Note the fixme that looks pretty old:

# FIXME(jamielennox): This is part of bug #1584008 and should default
# to True (or simply removed) in a major version bump.
self._case_sensitive = kwargs.pop('case_sensitive', False)

I'll try putting together a fix.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants