Skip to content

Fix content-type matching for debug endpoints#85

Open
benoit-nexthop wants to merge 1 commit intogleanwork:mainfrom
nexthop-ai:main
Open

Fix content-type matching for debug endpoints#85
benoit-nexthop wants to merge 1 commit intogleanwork:mainfrom
nexthop-ai:main

Conversation

@benoit-nexthop
Copy link

The debug endpoints (/api/index/v1/debug/*) return 'application/json' without the 'charset=UTF-8' parameter, but the generated SDK code was checking for an exact match with 'application/json; charset=UTF-8'.

This caused the SDK to return 'unknown content-type received' errors even though the response was valid JSON and the status was 200.

Changed the content-type pattern from 'application/json; charset=UTF-8' to 'application/json' in:

  • Datasource.Status() - /api/index/v1/debug/{datasource}/status
  • People.Debug() - /api/index/v1/debug/{datasource}/user

The MatchContentType() function already handles charset parameters correctly via mime.ParseMediaType(), so this change allows it to match both 'application/json' and 'application/json; charset=UTF-8'.

Fixes: #84

@benoit-nexthop benoit-nexthop requested a review from a team as a code owner March 12, 2026 19:48
The debug endpoints (/api/index/v1/debug/*) return 'application/json'
without the 'charset=UTF-8' parameter, but the generated SDK code was
checking for an exact match with 'application/json; charset=UTF-8'.

This caused the SDK to return 'unknown content-type received' errors
even though the response was valid JSON and the status was 200.

Changed the content-type pattern from 'application/json; charset=UTF-8'
to 'application/json' in:
- Datasource.Status() - /api/index/v1/debug/{datasource}/status
- People.Debug() - /api/index/v1/debug/{datasource}/user

The MatchContentType() function already handles charset parameters
correctly via mime.ParseMediaType(), so this change allows it to
match both 'application/json' and 'application/json; charset=UTF-8'.

Fixes: gleanwork#84
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Debug endpoint returns an error despite successful API call

1 participant