From ca5e1ea09bb094982155e571b9a48694bdcf5910 Mon Sep 17 00:00:00 2001 From: Pedro Santos Date: Tue, 8 Jun 2021 08:28:06 +0100 Subject: [PATCH 1/2] fix #407 fix https://github.com/mapbox/mapbox-sdk-js/issues/407 --- lib/browser/browser-layer.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lib/browser/browser-layer.js b/lib/browser/browser-layer.js index d13123ae..f6c3c85e 100644 --- a/lib/browser/browser-layer.js +++ b/lib/browser/browser-layer.js @@ -103,6 +103,8 @@ function sendRequestXhr(request, xhr) { function createRequestXhr(request, accessToken) { var url = request.url(accessToken); var xhr = new window.XMLHttpRequest(); + xhr.responseType = ["arraybuffer", "blob", "document", "json", "text"].includes(request.responseType) ? request.responseType : "" + xhr.open(request.method, url); Object.keys(request.headers).forEach(function(key) { xhr.setRequestHeader(key, request.headers[key]); From fc11ed97f167f3eb3b1f88363a58b6ee09b9c111 Mon Sep 17 00:00:00 2001 From: Pedro Santos Date: Tue, 8 Jun 2021 08:43:00 +0100 Subject: [PATCH 2/2] fixes static map https://github.com/mapbox/mapbox-sdk-js/blob/9ccbcc50cfcfa37153cfb0c3487dea8d49e9761a/services/static.js#L301-L308 https://github.com/mapbox/mapbox-sdk-js/issues/317 --- lib/browser/browser-layer.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/browser/browser-layer.js b/lib/browser/browser-layer.js index f6c3c85e..fed3c50c 100644 --- a/lib/browser/browser-layer.js +++ b/lib/browser/browser-layer.js @@ -103,7 +103,9 @@ function sendRequestXhr(request, xhr) { function createRequestXhr(request, accessToken) { var url = request.url(accessToken); var xhr = new window.XMLHttpRequest(); - xhr.responseType = ["arraybuffer", "blob", "document", "json", "text"].includes(request.responseType) ? request.responseType : "" + if (request.encoding === "binary") { + xhr.responseType = "blob" + } xhr.open(request.method, url); Object.keys(request.headers).forEach(function(key) {