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

Add response extension #4

Merged
merged 1 commit into from
Jul 28, 2023
Merged

Add response extension #4

merged 1 commit into from
Jul 28, 2023

Conversation

karpetrosyan
Copy link
Owner

@karpetrosyan karpetrosyan commented Jul 28, 2023

Add a response extension that indicates whether or not the response was taken from the cache.

Example:

import httpx
import hishel

with httpx.HTTPTransport() as transport:
    with hishel.CacheTransport(transport=transport) as cache_transport:
        request = httpx.Request(
            "GET",
            "https://example.com",
        )

        response = cache_transport.handle_request(request)
        from_cache = response.extensions['from_cache']
        print(from_cache)

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 this pull request may close these issues.

1 participant