Skip to content

Add type based matching #239

@nhtgl

Description

@nhtgl

I was thinking that it would be useful to have typed based matching. One of the use cases would when app sends an generated uuid and all you care about is if the type is correct and doesn't really care about specific value.

ie.

import uuid
import respx
import httpx
 

respx_mock.post("http://example.com", json={"id": uuid.UUID})
httpx.post("http://example.com", json={"id": uuid.uuid4()}  # should be mocked by respx

This could be extended to other types like simple types, types from typing module, etc.

WDYT?

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions