Permalink
Browse files

Use the less strict get#asBuffer which is not as finicky about Conten…

…t-Type headers.
  • Loading branch information...
1 parent 932a6d4 commit 956a81fde8dd99d5f8758ea64aa0da70f3ffe7f6 Young Hahn committed Mar 17, 2013
Showing with 2 additions and 2 deletions.
  1. +2 −2 lib/tilejson.js
View
@@ -219,7 +219,7 @@ TileJSON.prototype.getGrid = function(z, x, y, callback) {
timeout: this.timeout,
headers: {Connection:'Keep-Alive'},
agent: agent
- }).asString(function(err, grid, headers) {
+ }).asBuffer(function(err, grid, headers) {
if (err) return callback(new Error('Grid does not exist'));
var modified = headers['last-modified'] ? new Date(headers['last-modified']) : new Date;
@@ -233,7 +233,7 @@ TileJSON.prototype.getGrid = function(z, x, y, callback) {
}
// TODO: compression
- grid = grid.replace(/^\s*\w+\s*\(|\)\s*;?\s*$/g, '');
+ grid = grid.toString('utf8').replace(/^\s*\w+\s*\(|\)\s*;?\s*$/g, '');
callback(null, JSON.parse(grid), responseHeaders);
});

0 comments on commit 956a81f

Please sign in to comment.