Closed justingiffard-impact closed 5 months ago
So I appear to be wrong with thinking that the headers are lost when being packed into the resource enum... but still not sure why this is happening 🤔
I found the issue... one of the logos was 404ing and returning a cookie... then all subsequent calls were sending up that cookie which for some reason was being blocked by the server slow claps good job backend team
just for future reverence this is what I do:
I create a URLRequest from the url I then add the headers I need I then tell the request not to handle cookies I then use make a ImageRequest from that
var request = URLRequest(url: url)
request.setValue("Bearer \(token)", forHTTPHeaderField: "Authorization")
request.httpShouldHandleCookies = false
let imageRequest: ImageRequest? = if let url { .init(url: url) } else { nil }
then I use that imageRequest
inside my SwiftUI in a LazyImage
Hiya, I was wondering if you could help me
I posted this in #183 but figured seeing as its closed it may not be seen
I have tried the route of making a URLRequest and then making a ImageRequest out of it and then using LazyImage(request: ImageRequest, content: Content) and it seems to stripping the auth headers
From what I can tell (and please correct me if I am wrong) the ImageRequest(urlRequest:) initialiser packs the urlRequest into a Resource enum. I cannot tell if its there that the headers are lost or not though
If I look in lldb though the imageRequest looks like this:
ImageRequest(resource: https://redacted.com/redacted/Logo, priority: normal, processors: [], options: Options(rawValue: 0), userInfo: [:])
which doesn't really make it clear if it uses the headers or not
if I look at the urlRequest though I can see the headers are present
interestingly if I look at state it seems to be giving me a 500 which is very weird. If I try the exact same url in Insomnia I get 401 without the
Authorization
and 200 with itany ideas?