Skip to content

None type doesn't work in data matching as of v0.21.0 #258

@slingshotsys

Description

@slingshotsys

As of the latest version v0.21.0, None values in data lookups don't work:

import httpx
import respx


@respx.mock
def test():
    data = {"test": None}

    respx.post("http://test.com", data=data).respond()

    response = httpx.post("http://test.com", data=data)

    assert response.status_code == 200


if __name__ == "__main__":
    test()

output:

respx.models.AllMockedAssertionError: RESPX: <Request('POST', 'http://test.com/')> not mocked!

This test passes successfully in v0.20.2

The following do work:

    data = {"test": ""}
    respx.post("http://test.com", data=data).respond()
    response = httpx.post("http://test.com", data=data)
    respx.post("http://test.com", data={"test": ""}).respond()
    response = httpx.post("http://test.com", data={"test": None})

So there's just a bug somewhere translating None to ""

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