- From: Anne van Kesteren <annevk@annevk.nl>
- Date: Tue, 26 Apr 2016 10:57:47 +0200
- To: Kirill Dmitrenko <dmikis@yandex-team.ru>
- Cc: WebApps WG <public-webapps@w3.org>
On Mon, Apr 25, 2016 at 8:10 PM, Kirill Dmitrenko <dmikis@yandex-team.ru> wrote: > I've found in the spec of XHR Level 2 that if a malformed JSON's received from a server, the response property would be set to null. But null is a valid JSON, so, if I understand correctly, there is no way to distinct a malformed JSON response from a response containing only 'null', which is, again, a valid JSON: > > $ node -p -e 'JSON.parse("null")' > null > $ Use the fetch() API instead. It'll rethrow the exception for this case: https://fetch.spec.whatwg.org/#fetch-api. Also, "XHR Level 2" is no longer maintained. You want to look at https://xhr.spec.whatwg.org/ instead (though for this specific case it'll say the same thing). -- https://annevankesteren.nl/
Received on Tuesday, 26 April 2016 08:58:12 UTC