geotiffjs / geotiff.js

geotiff.js is a small library to parse TIFF files for visualization or analysis. It is written in pure JavaScript, and is usable in both the browser and node.js applications.
https://geotiffjs.github.io/
MIT License
845 stars 175 forks source link

credentials option is ignored #415

Closed pavelvasev closed 6 months ago

pavelvasev commented 7 months ago
  1. FetchClient constructor gets credentials parameter, see /src/source/client/fetch.js line 30

  2. In FetchClient::request method, credentials is used from that method's arguments. The credentials parameter passed to constructor is ignored in method's body, see /src/source/client/fetch.js line 41

  3. Callers of FetchClient::request seems never supply that parameter in method's arguments. It seems the only caller lives in src/source/remote.js

I suggest and ask somebody responsible to fix the method with the following code:

  async request({ headers, signal } = {}) {
    const response = await fetch(this.url, {
      headers, credentials:this.credentials, signal,
    });
    return new FetchResponse(response);
  }
danw-mpl commented 6 months ago

I just ran into this one indirectly via OpenLayers. :(

danw-mpl commented 6 months ago

@constantinius Hey - is there someone that could take a look at this?

Many thanks!

constantinius commented 6 months ago

I just released v2.1.2, which should include this.