Skip to content

Commit 4d570d3

Browse files
authored
fix: fix content-type check in fetchJson (@fehmer) (monkeytypegame#6465)
1 parent 2a4fe18 commit 4d570d3

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

frontend/src/ts/utils/json-data.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ async function fetchJson<T>(url: string): Promise<T> {
1212
if (!url) throw new Error("No URL");
1313
const res = await fetch(url);
1414
if (res.ok) {
15-
if (res.headers.get("content-type") !== "application/json") {
15+
if (!res.headers.get("content-type")?.startsWith("application/json")) {
1616
throw new Error("Content is not JSON");
1717
}
1818
return (await res.json()) as T;

0 commit comments

Comments
 (0)