Skip to content

Commit 7dcdd76

Browse files
feat(client): accept RFC6838 JSON content types (#108)
1 parent 4ab7bb4 commit 7dcdd76

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/core.ts

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

5050
const contentType = response.headers.get('content-type');
51-
const isJSON =
52-
contentType?.includes('application/json') || contentType?.includes('application/vnd.api+json');
51+
const mediaType = contentType?.split(';')[0]?.trim();
52+
const isJSON = mediaType?.includes('application/json') || mediaType?.endsWith('+json');
5353
if (isJSON) {
5454
const json = await response.json();
5555

0 commit comments

Comments
 (0)