Skip to content

Commit 4d8f4ce

Browse files
feat(client): accept RFC6838 JSON content types (#34)
1 parent 27ce482 commit 4d8f4ce

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/internal/parse.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,8 @@ export async function defaultParseResponse<T>(client: Lightswitch, props: APIRes
2626
}
2727

2828
const contentType = response.headers.get('content-type');
29-
const isJSON =
30-
contentType?.includes('application/json') || contentType?.includes('application/vnd.api+json');
29+
const mediaType = contentType?.split(';')[0]?.trim();
30+
const isJSON = mediaType?.includes('application/json') || mediaType?.endsWith('+json');
3131
if (isJSON) {
3232
const json = await response.json();
3333
return json as T;

0 commit comments

Comments
 (0)