Currently there appears to be a way to override the global fetch for every endpoint. However, I do not see a way to edit these headers per endpoint.
I have an ogc endpoint that has basic auth and would like to pass auth headers for that exact endpoint.
I am not sure what the simpler option would be but maybe edit the setFetchOptions to take in a map were each key is an endpoint url and apply fetch based on that.
A very spaghetti code way could be something like
setFetchOptions({ "www.some-endpoint.com": { headers: {"Auth": "Basic username:password"}}});
and then in sharedFetch
Get the keys of getFetchOptions()... and find the matching one based parameter url.
if url.startsWith(key) use those options
...
Or maybe add an options parameter to sharedFetch that is optional and then add that param to every other function that uses sharedFetch directly or indirectly as optional.
Currently there appears to be a way to override the global fetch for every endpoint. However, I do not see a way to edit these headers per endpoint.
I have an ogc endpoint that has basic auth and would like to pass auth headers for that exact endpoint.
I am not sure what the simpler option would be but maybe edit the setFetchOptions to take in a map were each key is an endpoint url and apply fetch based on that.
A very spaghetti code way could be something like
and then in sharedFetch
Get the keys of
getFetchOptions()... and find the matching one based parameter url.if url.startsWith(key) use those options...
Or maybe add an options parameter to sharedFetch that is optional and then add that param to every other function that uses sharedFetch directly or indirectly as optional.