Skip to content

fix(odc-cli): report the status for an error response with an empty body - #1809

Open
jay23606 wants to merge 1 commit into
DouglasNeuroInformatics:mainfrom
jay23606:fix/odc-cli-empty-error-body
Open

jay23606 wants to merge 1 commit into
DouglasNeuroInformatics:mainfrom
jay23606:fix/odc-cli-empty-error-body

Conversation

@jay23606

Copy link
Copy Markdown

Fixes #1779

Summary

  • `HttpResponse.to_json` merged the body into the output with `props.update(**self.data)` on a non-2xx status. An empty error body is stored as `data=None`, so the CLI crashed with `TypeError: dict.update() argument after ** must be a mapping, not NoneType`.
  • When the error body is not an object, the output now carries the `statusCode`. Object bodies are merged as before.

Test

  • `cli/` has no test harness, and AGENTS.md says nothing checks it on a pull request, so I verified it by loading the script directly:
    • `HttpResponse(data=None, status=502).to_json(include_data=False)` gives `{"statusCode": 502}`. The original script raises the `TypeError`.
    • An object error body still merges its fields as before.
  • Not run: the rest of the repo's checks, which do not cover `cli/`.

🤖 Generated with Claude Code

On a non-2xx status, HttpResponse.to_json merged the response body into its
output with update(**data). An empty body is stored as data=None, so a
proxy's 502 or 405 with no body crashed the CLI with a TypeError instead of
showing the status code.

Show the status code when the error body is not an object.

Fixes DouglasNeuroInformatics#1779
@jay23606
jay23606 requested a review from joshunrau as a code owner October 12, 2026 22:23

This branch has not been deployed

No deployments
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.

odc-cli crashes with a TypeError traceback when an error response has an empty body

1 participant