Skip to content

Recorded query parameters decode escaped separators twice #331

Description

@bensynapse

I run Live Tennis API.

Recorded query parameters are decoded twice. A value such as one%26two becomes two fields instead of the value one&two.

This fails against the current main branch:

import requests

from mocket import Mocket, Mocketizer
from mocket.mocks.mockhttp import Entry

url = "http://testme.org/?q=one%26two"
with Mocketizer(strict_mode=True):
    Entry.single_register(Entry.GET, url, body="ok")
    with requests.get(url, timeout=5) as response:
        assert response.content == b"ok"
    assert Mocket.last_request().querystring == {"q": ["one&two"]}

The actual result is {"q": ["one"], "two": [""]}. Escaped plus signs and percent signs are also decoded twice.

PR #330 fixes this and adds regression tests. I opened this issue at the maintainer's request on that PR.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions