mirror of
https://github.com/BookStackApp/BookStack.git
synced 2025-07-28 17:02:04 +03:00
Updated http service to not read 204 response data
This commit is contained in:
@ -141,10 +141,14 @@ async function request(url, options = {}) {
|
|||||||
/**
|
/**
|
||||||
* Get the content from a fetch response.
|
* Get the content from a fetch response.
|
||||||
* Checks the content-type header to determine the format.
|
* Checks the content-type header to determine the format.
|
||||||
* @param response
|
* @param {Response} response
|
||||||
* @returns {Promise<Object|String>}
|
* @returns {Promise<Object|String>}
|
||||||
*/
|
*/
|
||||||
async function getResponseContent(response) {
|
async function getResponseContent(response) {
|
||||||
|
if (response.status === 204) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
const responseContentType = response.headers.get('Content-Type');
|
const responseContentType = response.headers.get('Content-Type');
|
||||||
const subType = responseContentType.split('/').pop();
|
const subType = responseContentType.split('/').pop();
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user