Fix content-type matching for debug endpoints#85
Open
benoit-nexthop wants to merge 1 commit intogleanwork:mainfrom
Open
Fix content-type matching for debug endpoints#85benoit-nexthop wants to merge 1 commit intogleanwork:mainfrom
benoit-nexthop wants to merge 1 commit intogleanwork:mainfrom
Conversation
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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:
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