Skip to content

Commit

Permalink
fixed #1368 coil headers again 💀
Browse files Browse the repository at this point in the history
  • Loading branch information
fire-light42 authored Dec 7, 2024
1 parent 803f93c commit 54df562
Showing 1 changed file with 8 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ import coil3.SingletonImageLoader
import coil3.disk.DiskCache
import coil3.load
import coil3.memory.MemoryCache
import coil3.network.NetworkHeaders
import coil3.network.httpHeaders
import coil3.network.okhttp.OkHttpNetworkFetcherFactory
import coil3.request.CachePolicy
import coil3.request.ErrorResult
Expand Down Expand Up @@ -91,10 +93,12 @@ object ImageLoader {

// Use Coil's built-in load method but with our custom module
this.load(imageData, SingletonImageLoader.get(context)) {
headers?.forEach { (key, value) ->
extras[Extras.Key<String>("User-Agent")] = USER_AGENT
extras[Extras.Key<String>(key)] = value
}
this.httpHeaders(NetworkHeaders.Builder().also { headerBuilder ->
headerBuilder.add("User-Agent", USER_AGENT)
headers?.forEach { (key, value) ->
headerBuilder.add(key,value)
}
}.build())

builder() // if passed
}
Expand Down

2 comments on commit 54df562

@fire-light42
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@IndusAryan I am 1 bug away from reverting your coil PR.

@DZFOORT
Copy link

@DZFOORT DZFOORT commented on 54df562 Dec 7, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅✅✅✅✅✅✅✅✅✅

Please sign in to comment.