Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RawURL removed from httpx 0.23.1 #221

Closed
g-as opened this issue Nov 18, 2022 · 2 comments · Fixed by #223
Closed

RawURL removed from httpx 0.23.1 #221

g-as opened this issue Nov 18, 2022 · 2 comments · Fixed by #223

Comments

@g-as
Copy link

g-as commented Nov 18, 2022

encode/httpx#2241

httpx dropped support for url as tuple[bytes, bytes, Optional[int], bytes], which breaks def to_httpx_request(cls, **kwargs): as well as some of the Pattern logic.

@lundberg
Copy link
Owner

Thanks, looking at this now 😉

@g-as
Copy link
Author

g-as commented Nov 18, 2022

    @classmethod
    def to_httpx_request(cls, **kwargs):
        """
        Create a `HTTPX` request from transport request arg.
        """
        request = kwargs["request"]
        url = httpx.URL(
            scheme=request.url.scheme.decode(),
            host=request.url.host.decode(),
            port=request.url.port,
            path=request.url.target.decode(),
        )
        return httpx.Request(
            request.method,
            url,
            headers=request.headers,
            stream=request.stream,
            extensions=request.extensions,
        )

should work for all httpx versions

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants