I try to download images from Amazon S3 server via AlamofireImage framework.
The Images on the S3 server, save with 'Content-Type' = 'binary/octet-stream'.
In the beginning I got the Error:
Failed to validate response due to unacceptable content type.
So, I tried to change/update the HTTP Header's request in order to support with binary/octet-stream'
I updated the method:
private func URLRequestWithURL(URL: NSURL) -> NSURLRequest
In the UIImageView+AlamofireImage.swift file to:
private func URLRequestWithURL(URL: NSURL) -> NSURLRequest {
let mutableURLRequest = NSMutableURLRequest(URL: URL)
mutableURLRequest.addValue("binary/octet-stream", forHTTPHeaderField: "Content-Type")
return mutableURLRequest
}
And is still not working, Just after I added the:
let contentTypes: Set<String> = ["Content-Type", "binary/octet-stream"]
Request.addAcceptableImageContentTypes(contentTypes)
The problem was solved, But I really don't like the fact that I changed a private method in the AlamofireImage framework.
I wonder if there is an elegant way to solve this problem, given I can't change the images 'Content-Type' in the S3 server.
Thanks