From 3ac6229822257bc15fde1e7a197c71e942031d25 Mon Sep 17 00:00:00 2001 From: Victor Westerhuis Date: Wed, 22 Jan 2025 18:29:21 +0100 Subject: [PATCH] Fix possible types for json parameter to Route.respond --- docs/api.md | 4 ++-- respx/models.py | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/docs/api.md b/docs/api.md index 170d368..726ea1b 100644 --- a/docs/api.md +++ b/docs/api.md @@ -149,7 +149,7 @@ Shortcut for creating and mocking a `HTTPX` [Response](#response). > Response *text* content to mock, with automatic content-type header added. > * **html** - *(optional) str* > Response *HTML* content to mock, with automatic content-type header added. -> * **json** - *(optional) str | list | dict* +> * **json** - *(optional) str | list | dict | tuple | float* > Response *JSON* content to mock, with automatic content-type header added. > * **stream** - *(optional) Iterable[bytes]* > Response *stream* to mock. @@ -190,7 +190,7 @@ Shortcut for creating and mocking a `HTTPX` [Response](#response). > Text content, with automatic content-type header added. > * **html** - *(optional) str* > HTML content, with automatic content-type header added. -> * **json** - *(optional) str | list | dict* +> * **json** - *(optional) str | list | dict | tuple | float* > JSON content, with automatic content-type header added. > * **stream** - *(optional) Iterable[bytes]* > Content *stream*. diff --git a/respx/models.py b/respx/models.py index 9690324..d32dfac 100644 --- a/respx/models.py +++ b/respx/models.py @@ -277,7 +277,7 @@ def respond( content: Optional[Content] = None, text: Optional[str] = None, html: Optional[str] = None, - json: Optional[Union[str, List, Dict]] = None, + json: Optional[Union[str, List, Dict, Tuple, float]] = None, stream: Optional[Union[httpx.SyncByteStream, httpx.AsyncByteStream]] = None, content_type: Optional[str] = None, http_version: Optional[str] = None,