From f3ee8f2d4cb84536c11f42ad249e629d8a01ac45 Mon Sep 17 00:00:00 2001 From: Dan Brown Date: Wed, 30 Sep 2020 22:32:03 +0100 Subject: [PATCH] Updated http service to not read 204 response data --- resources/js/services/http.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/resources/js/services/http.js b/resources/js/services/http.js index 8ecd6c109..b05dd23bf 100644 --- a/resources/js/services/http.js +++ b/resources/js/services/http.js @@ -141,10 +141,14 @@ async function request(url, options = {}) { /** * Get the content from a fetch response. * Checks the content-type header to determine the format. - * @param response + * @param {Response} response * @returns {Promise} */ async function getResponseContent(response) { + if (response.status === 204) { + return null; + } + const responseContentType = response.headers.get('Content-Type'); const subType = responseContentType.split('/').pop();