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

Is there a way to use cookies when fetching the remote image? #26

Open
fred-riverside opened this issue Mar 4, 2024 · 0 comments
Open

Comments

@fred-riverside
Copy link

Hi there!
I wanted to download an image with a URL that is checked by the back-end with a cookie.
If I just feed AsyncCachedImage with this URL, it brings nothing:

CachedAsyncImage(url: myURL)

So I tried to feed it with a URLRequest instead, after setting the HTTPHeaderFields of the request with my cookie.

       var urlRequest = URLRequest(url: url)
        urlRequest.httpShouldHandleCookies = true
        var headers = [
            "Content-Type": "application/json",
            "Cookie": "blablabla"
        ]
        urlRequest.allHTTPHeaderFields = headers

and then pass this URLRequest to the CachedAsyncImage:

CachedAsyncImage(urlRequest: urlRequest)

But that didn't work either.
Do you think the CachedAsyncImage actually uses the header of the request we pass?
Thanks
Frederic

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

No branches or pull requests

1 participant