nakarte

Source code of https://map.sikmir.ru (fork)
git clone git://git.sikmir.ru/nakarte
Log | Files | Refs | LICENSE

commit a824c31cc7192386e1f22b2ef8e96493aab7da51
parent 3752a244b8b8b6b94aa6ecea74cc062544a61fa9
Author: Sergey Orlov <wladimirych@gmail.com>
Date:   Sat,  8 Aug 2020 11:31:23 +0200

xhr-promise: return null for invalid json data

browsers do return null in xhr.response

Diffstat:
Msrc/lib/xhr-promise/index.js | 2+-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/lib/xhr-promise/index.js b/src/lib/xhr-promise/index.js @@ -76,7 +76,7 @@ class XMLHttpRequestPromise { // xhr.response is readonly xhr.responseJSON = JSON.parse(xhr.response); } catch (e) { - // leave xhr.responseJSON undefined if response is not valid JSON + xhr.responseJSON = null; } } else { xhr.responseJSON = xhr.response;