From fed953d1950b3880bba458b2707b5e19985f225b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Garc=C3=ADa=20Aubert?= Date: Mon, 24 Apr 2017 18:55:08 +0200 Subject: [PATCH] Support mvt tiles --- test/support/test-client.js | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/test/support/test-client.js b/test/support/test-client.js index 75fa51e0..5998912f 100644 --- a/test/support/test-client.js +++ b/test/support/test-client.js @@ -485,6 +485,13 @@ TestClient.prototype.getTile = function(z, x, y, params, callback) { expectedResponse.headers['Content-Type'] = 'image/png'; } + var isMvt = format.match(/mvt$/); + + if (isMvt) { + request.encoding = 'binary'; + expectedResponse.headers['Content-Type'] = 'application/x-protobuf'; + } + assert.response(server, request, expectedResponse, function(res, err) { assert.ifError(err); @@ -492,7 +499,13 @@ TestClient.prototype.getTile = function(z, x, y, params, callback) { if (isPng) { obj = mapnik.Image.fromBytes(new Buffer(res.body, 'binary')); - } else { + } + else if (isMvt) { + obj = new mapnik.VectorTile(z, x, y); + obj.setDataSync(new Buffer(res.body, 'binary')); + } + + else { obj = JSON.parse(res.body); }