Skip to content

Commit d4adb66

Browse files
feat(client): accept RFC6838 JSON content types (#1364)
1 parent d1c053b commit d4adb66

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

Diff for: src/core.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -62,8 +62,8 @@ async function defaultParseResponse<T>(props: APIResponseProps): Promise<T> {
6262
}
6363

6464
const contentType = response.headers.get('content-type');
65-
const isJSON =
66-
contentType?.includes('application/json') || contentType?.includes('application/vnd.api+json');
65+
const mediaType = contentType?.split(';')[0]?.trim();
66+
const isJSON = mediaType?.includes('application/json') || mediaType?.endsWith('+json');
6767
if (isJSON) {
6868
const json = await response.json();
6969

0 commit comments

Comments
 (0)