pytest_httpx_recorder.recorder.recorder
This module provides a class to record HTTP requests and responses using the httpx library. It allows users to capture and analyze HTTP traffic for testing and debugging purposes.
- Classes:
ResRecorder: Records HTTP requests and responses.
- Functions:
_mocked_handle_request: Mocks the handle_request method of httpx.HTTPTransport. _mocked_handle_async_request: Mocks the handle_async_request method of httpx.AsyncHTTPTransport.
ResRecorder
- class pytest_httpx_recorder.recorder.recorder.ResRecorder(record_request_headers: bool = True, request_headers_blacklist: ~typing.List[str] = <object object>, record_request_content: bool = True)[source]
A class to record HTTP requests and responses.
- Parameters:
record_request_headers (bool) – Flag to determine if request headers should be recorded.
request_headers_blacklist (List[str]) – List of header keys to exclude from recording.
record_request_content (bool) – Flag to determine if request content should be recorded.
- Variables:
responses (List[RecordedResponse]) – List of recorded responses.
- __init__(record_request_headers: bool = True, request_headers_blacklist: ~typing.List[str] = <object object>, record_request_content: bool = True)[source]
- async_record()[source]
An async context manager for recording asynchronous HTTP requests and responses.
- Yields:
None