How to use the respx.models.build_request function in respx

To help you get started, we’ve selected a few respx examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github lundberg / respx / respx / transports.py View on Github external
def record(
        self,
        request: Any,
        response: Optional[Any],
        pattern: Optional[RequestPattern] = None,
    ) -> None:
        request = build_request(request)
        response = build_response(response, request=request)

        if pattern:
            pattern.stats(request, response)

        self.stats(request, response)

        # Copy stats due to unwanted use of property refs in the high-level api
        self.calls[:] = (
            (request, response) for (request, response), _ in self.stats.call_args_list
        )