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
No known key found for this signature in database
GPG Key ID: 46D9F943C24A2EF9

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