Skip to content

[FIX] fastapi_log: log HTTP exceptions whose detail is not a string - #668

Open
jaenbox wants to merge 1 commit into
OCA:17.0from
jaenbox:17.0-fix-fastapi_log-exception-detail
Open

jaenbox wants to merge 1 commit into
OCA:17.0from
jaenbox:17.0-fix-fastapi_log-exception-detail

Conversation

@jaenbox

@jaenbox jaenbox commented Oct 20, 2026

Copy link
Copy Markdown

FastAPI allows any JSON-serializable detail in HTTPException (e.g. a dict), but _prepare_log_exception stores it as is in the binary response_body, so flushing the log fails
with TypeError: unhashable type: 'slice' and the request ends in a 500.

Now a detail that is not a string is stored as JSON. Tests added; the dict one fails without the fix. 16.0 and 18.0 have the same issue.

@OCA-git-bot

Copy link
Copy Markdown
Contributor

Hi @paradoxxxzero,
some modules you are maintaining are being modified, check this out!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants