1
0
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:
Dan Brown
2020-09-30 22:32:03 +01:00
parent ea406690f5
commit f3ee8f2d4c

View 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();