From c1393221a0b73586ac034b1e10c5d824d8c7e682 Mon Sep 17 00:00:00 2001 From: Rhys Mills Date: Thu, 28 Nov 2024 12:03:33 +0000 Subject: [PATCH] Assume requests are json if the content-type header includes public/video-ui/src/services/pandaReqwest.js - doesn't need to be an exact match --- public/video-ui/src/services/pandaReqwest.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/public/video-ui/src/services/pandaReqwest.js b/public/video-ui/src/services/pandaReqwest.js index d5ff5a4f7..5c495a705 100644 --- a/public/video-ui/src/services/pandaReqwest.js +++ b/public/video-ui/src/services/pandaReqwest.js @@ -17,7 +17,9 @@ export const poll = (url, body, timeout) => { fetch(url, body) .then(checkStatus) .then(response => { - if (response.headers.get("content-type") === "application/json"){ + const contentTypeHeader = response.headers.get("content-type"); + + if (contentTypeHeader && contentTypeHeader.includes("application/json")){ return response.json(); } return response.text();