Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
.DS_Store
_site
.settings
*.7z
node_modules
node.exe
15 changes: 14 additions & 1 deletion lib/tilejson.js
Original file line number Diff line number Diff line change
Expand Up @@ -211,8 +211,21 @@ TileJSON.prototype.get = function(url, callback) {
var opts = {
url: url,
encoding: null,
//TODO: find a clean solution
//tell requestjs to *not* unzip, on the fly when fetching
//vetor tiles (*.pbf *.mvt), because all tile* modules
//expect gzipped buffers.
//let requestjs unzip all other requests, as gzipped responses
//break stuff further down the line.
gzip: !(url.indexOf('.pbf') > -1 || url.indexOf('.mvt') > -1),
timeout: tilejson.timeout,
headers: {Connection: 'Keep-Alive'},
headers: {
Connection: 'Keep-Alive',
//always send gzip header, to enable 3rd party vector tile
//sources that gzip their response according to this header
//being present
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is more to follow the HTTP specification than to meet the needs of third-party sources.

'Accept-Encoding': 'gzip;q=1, identity;q=0'
},
agent: url.indexOf('https:') === 0 ? httpsagent : agent
};

Expand Down