Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR improves setting custom http headers with each tile request in order to support an authentication layer for protected custom resources.
It solves two problems:
Filtering feature prevents the user from leaking protected headers to resources which are not protected (and controlled by someone else). It is an optional parameters and passing null will cause headers to be appended to each request, so functionality stays as is. Passing a filter will cause appending headers only to requests, which contain filter content in URLs. Passing an empty filter will cause that no headers are appended to requests.
Mutable headers is an iOS issue. Setting headers at startup works, but setting them the second time (e.g. when access token invalidates) does not work. The proposed solution involves swizzling and because of that extra documentation was added to make sure end-users understand the risks when using this approach. That's why it is opt-in.
An additional method for checking previously set headers state was added to allow easy checking, whether setting headers works, since swizzling can break with SDK update.
An example with a local server was added to illustrate the behaviour of setting http headers client side and handling them server side.