Closed JakobMiksch closed 11 months ago
Very good point. To me the following optional parameters would be relevant:
cors
, no-cors
, or same-origin
omit
, same-origin
or include
Taken from https://developer.mozilla.org/en-US/docs/Web/API/fetch#parameters
These parameters should be provided when creating endpoints and propagated everywhere http requests are done, including in the worker.
I found out that OpenLayers has a WMS parser as well that is enough for my purposes: https://openlayers.org/en/latest/examples/wms-capabilities.html There I can provide custom headers. That's why, for the moment, I will not use ogc-client for this task anymore. Hence, I also do not plan to make a PR anymore. Sorry for the confusion. Thanks anyway for the great library 🎖️
Thanks, leaving this open because this is still relevant!
@jahow another option to implement this, would be to allow to hand over custom fetch instances. (see https://rapidapi.com/guides/interceptors-fetch ) It might be easier to implement, because all HTTP stuff can be configured in fetch, whereas this library just does stuff within the OGC API world ...
Hmm, interesting. Maybe instead of having to provide a full fetch
instance we could offer a pre-process and post-process hook. The issue I see is that this will not be possible in the worker, so using these hooks would need to disable worker usage altogether.
So I guess at first it would be reasonable to take in an options object for each layer, as this is at least serializable.
@jahow your suggestion sounds good as well.
For some OGC services I need to add a custom header for authorization. However, currently it does not seem possible with this library to add a custom header. I guess a change needs to be done here: https://github.com/camptocamp/ogc-client/blob/main/src/shared/http-utils.ts
I can try to provide a fix. If you have any hint or preference how to implement it, please let me know.