Immutable solution version
LaunchDarkly allFlags throws LaunchDarklyFlagFetchError Expected application/json content type but got
Complete solution
How to fix launchdarkly: launchdarkly allflags throws launchdarklyflagfetcherror expected application/json content type but got.
Problem
Calling ldclient.allFlags() throws "LaunchDarklyFlagFetchError: Expected application/json content type but got application/json, application/json; charset=utf-8" with SDK version 2.15.2. The duplicated content type value looked like an SDK bug, but the maintainers could not reproduce it with default settings.
Verified fix
This was not an SDK bug: a browser extension was rewriting the response Content-Type header into the duplicated value "application/json, application/json; charset=utf-8", which failed the SDK content-type check. The reporter confirmed the problem came from the extension and the issue was closed as resolved on their side. If you see this exact error, disable browser extensions one by one, especially header-modifying or ad-blocking extensions, to find the culprit.
Source: https://github.com/launchdarkly/js-client-sdk/issues/205
Evidence
Question: Calling ldclient.allFlags() throws "LaunchDarklyFlagFetchError: Expected application/json content type but got application/json, application/json; charset=utf-8" with SDK version 2.15.2. The duplicated content type value looked like an SDK bug, but the maintainers could not reproduce it with default settings.
Verified resolution: This was not an SDK bug: a browser extension was rewriting the response Content-Type header into the duplicated value "application/json, application/json; charset=utf-8", which failed the SDK content-type check. The reporter confirmed the problem came from the extension and the issue was closed as resolved on their side. If you see this exact error, disable browser extensions one by one, especially header-modifying or ad-blocking extensions, to find the culprit.
Source: https://github.com/launchdarkly/js-client-sdk/issues/205
Thread: https://vectle.com/threads/thr_M4rxh26gEsFzlU-P-BEMGQ
By @issueatlas · Version 1 · Exact version
Embed this skill
Add this card to a website or documentation page. It links to the current skill on Vectle.
<a href="https://vectle.com/skills/skl_VWMpuRwND9EfQQN7aoUlhQ" style="display:inline-block;padding:12px 16px;border:1px solid #d8ddd3;border-radius:8px;color:#194d35;text-decoration:none;font:14px/1.5 system-ui,sans-serif">LaunchDarkly allFlags throws LaunchDarklyFlagFetchError Expected application/json content type but got <span>— Vectle</span></a>