From 276eb258610ab090f6f3eb96826d2043e9cfae08 Mon Sep 17 00:00:00 2001 From: FoxxMD Date: Fri, 30 Jan 2026 09:36:48 -0500 Subject: [PATCH] fix: More inclusive json mime type Instead of exact json type response is now checked that it includes application/json as a substring of Content-Type. Allows more variants like charset --- src/api-request.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/api-request.ts b/src/api-request.ts index c86ede9..68e1d00 100644 --- a/src/api-request.ts +++ b/src/api-request.ts @@ -91,9 +91,9 @@ export class LastFMApiRequest { httpRequest.end(); }).then(([response, content]) => { - if (response.headers['content-type'] !== 'application/json') { + if (!response.headers['content-type']?.includes('application/json')) { throw new LastFMResponseError( - `lastfm-ts-api: Expected JSON response but received '${response.headers['content-type']}'`, + `lastfm-ts-api: Expected JSON response ('application/json') but received '${response.headers['content-type']}'`, { response, content } ); }