From 9b639e09f2f471650cc854018d768cfe40a5bd78 Mon Sep 17 00:00:00 2001 From: Alexander Skvortsov Date: Tue, 16 Nov 2021 13:34:28 -0500 Subject: [PATCH] Fix errors on 20X responses with no body `''` is not json-parsable, so in that case we return null. This was the behavior prior to bac0e594eed0a8e7282c4772864075cac487d280 --- js/src/common/Application.tsx | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/js/src/common/Application.tsx b/js/src/common/Application.tsx index f840fdea8..461b25952 100644 --- a/js/src/common/Application.tsx +++ b/js/src/common/Application.tsx @@ -438,6 +438,10 @@ export default class Application { } try { + if (responseText === '') { + return null; + } + return JSON.parse(responseText); } catch (e) { throw new RequestError(500, `${responseText}`, options, xhr);