]> BookStack Code Mirror - bookstack/commitdiff
Updated http service to not read 204 response data
authorDan Brown <redacted>
Wed, 30 Sep 2020 21:32:03 +0000 (22:32 +0100)
committerDan Brown <redacted>
Wed, 30 Sep 2020 21:32:03 +0000 (22:32 +0100)
resources/js/services/http.js

index 8ecd6c109168d26a48024c3dbb847b130e3d1592..b05dd23bfd7222834eade6395f655d5916b1b2c1 100644 (file)
@@ -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();