dmytro-anokhin/url-image

Http Header fields

Uppalled opened this issue · 1 comments

On version 1 we used to pass a URLRequest and could easily set up any necessary header fields when initializing it, is there a way currently to add a header? If not can add it as another var on URLImageOptions and pass it to the URLSessionCoordinator

Implemented in 2.1.11. You can set it using Download.URLRequestConfiguration object (need to import DownloadManager module):

let configuration = Download.URLRequestConfiguration(allHTTPHeaderFields: [ "Field Name" : "Value" ])
let options = URLImageOptions(urlRequestConfiguration: configuration)

Can also be set globally:

URLImageService.shared.defaultOptions.urlRequestConfiguration.allHTTPHeaderFields = [
    "Field Name" : "Value"
]