Skip to content

NOW MANAGED ON CODEBERG

Updated http service to not read 204 response data

Dan Brownf3ee8f2d4cb8
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<Object|String>}
*/
async function getResponseContent(response) {
+ if (response.status === 204) {
+ return null;
+ }
+
const responseContentType = response.headers.get('Content-Type');
const subType = responseContentType.split('/').pop();