moa
moa copied to clipboard
Adding Custom Headers to download request (Bearer {{access_token}}) for example
Would be great to customize headers of all requests for images that are behind a secure endpoint
@pierre-wehbe that's a great idea, a pull request is always welcome.
We can add headers to MoaSettings and use it like this in an app:
Moa.settings.httpAdditionalHeaders = ["key": "value"]
which can then be added to URLSessionConfiguration.httpAdditionalHeaders in MoaHttpSession. However httpAdditionalHeaders does not accept all headers:
An NSURLSession object is designed to handle various aspects of the HTTP protocol for you. As a result, you should not modify the following headers: Authorization, Connection, Host, Proxy-Authenticate, Proxy-Authorization, WWW-Authenticate
so, if you use those we need a different approach.