Closed srmncnk closed 1 year ago
In order to make this work for web, https://github.com/andrea689/mapbox-gl-dart from @andrea689 would have to be corrected (more accurately, probably https://github.com/andrea689/mapbox-gl-dart/pull/17 would have to be completed).
Rebased to master.
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
@felix-ht Can we reopen and do something with this?
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.