Keep API error details when a response declares a JSON charset - #71196
Closed
rjgoyln wants to merge 1 commit into
Closed
Keep API error details when a response declares a JSON charset#71196rjgoyln wants to merge 1 commit into
rjgoyln wants to merge 1 commit into
Conversation
The Task SDK and airflow-ctl clients only parsed a server error body when the response Content-Type was exactly "application/json", so a media type carrying parameters — "application/json; charset=utf-8" from a proxy or gateway, for instance — fell through to raise_for_status(). Callers then lost the server's error detail and, because the raised exception was no longer a ServerResponseError, the status-specific handling in the supervisor and in the CLI commands stopped matching.
Contributor
Author
|
Closing in favour of #70936, which already covers the airflow-ctl side of this. The Task SDK client has the same exact-string Drafted-by: Claude Code (Opus 5) (no human review before posting) |
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.
Summary
Both API clients treated a response as a parseable error only when
Content-Typewas exactlyapplication/json, so any media type carrying parameters —application/json; charset=utf-8, as proxies and gateways routinely emit on the errors they generate themselves — skipped error parsing and fell through toraise_for_status(). That loses the server'sdetail, and it raises a plainhttpx.HTTPStatusError, so theexcept ServerResponseErrorbranches in the supervisor and in the CLI commands stop matching.Airflow's own API server is unaffected — Starlette appends a charset only to
text/*responses — so this surfaces only where something between client and API server rewrites the header. Parameters are now stripped and the media type case folded;application/problem+jsonremains unaccepted.Was generative AI tooling used to co-author this PR?
Generated-by: Claude Code (Opus 5) following the guidelines