Hi there,
I'd like to pass some additional headers to my image requests, how can I manage this ?
thx!
http://cocoadocs.org/docsets/Kingfisher/2.2.0/Classes/ImageDownloader.html#/s:vC10Kingfisher15ImageDownloader15requestModifierGSqFCSo19NSMutableURLRequestT__
Thx @onevcat ! :+1:
@arn00s Could you explain how you sorted it out?
@camill-a I can't find back the code, I finally used Alamofire and Alamofire-Image !
It's find I sorted it out, but Xcode is updating. I'll post my code asap
myImageView.kf_setImageWithURL(URL, optionsInfo:[...]).downloadTask?.ownerDownloader?.requestModifier = { request in
request.addValue("application/json", forHTTPHeaderField: "Content-Type")
...
}
It's not working yet, but I guess it's setted before the call as precised in the documentation right?
Since the image setting methods will use the default downloader, you could just set the modifier block to the default downloader to make things easier:
ImageDownloader.defaultDownloader.requestModifier = {
request in
// Set request header here
}
Looks better indeed, but where does this instance of ImageDownloader come from?
Edit: I guess it's related to KingfisherManager.sharedManager...
Edit2: Ok my bad, KingFisher import was missing. Shame on me. Thanks a lot
:) Never mind~
Very useful, thanks!
Most helpful comment
Since the image setting methods will use the default downloader, you could just set the modifier block to the default downloader to make things easier: