Leaflet / Leaflet.VectorGrid

Display gridded vector data (sliced GeoJSON or protobuf vector tiles) in Leaflet 1.0.0
598 stars 194 forks source link

Support adding headers to request #89

Open brendanvinson opened 7 years ago

brendanvinson commented 7 years ago

I'm currently extending VectorGrid.protobuf to do this for some custom code, but would be great if this was part of the main library. Feature would be useful in case of needing to send Authorization headers (JWT for example) among other things.

FranckKe commented 6 years ago

I have run into this issue. It's been added in this commit https://github.com/Leaflet/Leaflet.VectorGrid/commit/043e62a4d5c27139311a0073aa129df247f65737

Example

let options = {
  fetchOptions: {
    credentials: 'same-origin',
    headers : {
      Authorization: "Basic myCredentials"
    }
  }
}
let myLayer = L.vectorGrid.protobuf(myUrl, options);

Full options