protomaps / PMTiles

Cloud-optimized + compressed single-file tile archives for vector and raster maps
https://protomaps.com/docs/pmtiles/
BSD 3-Clause "New" or "Revised" License
2.12k stars 125 forks source link

Update adapters.ts import FetchSource and add custom headers #446

Closed reyemtm closed 2 months ago

reyemtm commented 2 months ago
reyemtm commented 2 months ago

If you are willing to add this let me know and I'll fix the TS errors.

bdon commented 2 months ago

This could lead to unexpected behavior because transformRequest is per-request: it could depend on some JS variables outside of the function, or it could be modified after the map is created with setTransformRequest. This PR would only capture the output of transformRequest at the first load of the pmtiles archive.

FetchSource is explicitly designed for static headers to add that do not change over the lifetime of the object.

reyemtm commented 2 months ago

Ok good points. I'll use the fetch source method. Thanks

On Wed, Sep 11, 2024, 12:09 AM Brandon Liu @.***> wrote:

This could lead to unexpected behavior because transformRequest is per-request: it could depend on some JS variables outside of the function, or it could be modified after the map is created with setTransformRequest. This PR would only capture the output of transformRequest at the first load of the pmtiles archive.

FetchSource is explicitly designed for static headers to add that do not change over the lifetime of the object.

— Reply to this email directly, view it on GitHub https://github.com/protomaps/PMTiles/pull/446#issuecomment-2342634906, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABQ2HUJBEHLH5KYFAZLTIKLZV7F67AVCNFSM6AAAAABN76QAAKVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDGNBSGYZTIOJQGY . You are receiving this because you authored the thread.Message ID: @.***>