Skip to content

Commit

Permalink
Assume requests are json if the content-type header includes
Browse files Browse the repository at this point in the history
public/video-ui/src/services/pandaReqwest.js - doesn't need to be an exact match
  • Loading branch information
rhystmills committed Jan 2, 2025
1 parent e0b9049 commit c139322
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion public/video-ui/src/services/pandaReqwest.js
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down

0 comments on commit c139322

Please sign in to comment.