mirror of
https://github.com/open-webui/open-webui.git
synced 2026-05-07 11:28:35 -05:00
[PR #16454] [CLOSED] fix: Handle JSONResponse objects in middleware to prevent TypeError #24140
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/open-webui/open-webui/pull/16454
Author: @jamesmalin
Created: 8/10/2025
Status: ❌ Closed
Base:
main← Head:fix/jsonresponse-middleware-error📝 Commits (1)
c90f953fix: Handle JSONResponse objects in middleware to prevent TypeError📊 Changes
1 file changed (+3 additions, -3 deletions)
View changed files
📝
backend/open_webui/utils/middleware.py(+3 -3)📄 Description
Fixes #16452
Problem
The middleware was attempting to use the 'in' operator and .get() method directly on JSONResponse objects, causing TypeErrors when the API returned error responses.
Solution
Added isinstance(response, dict) checks before using 'in' operator and calling .get() method to ensure operations are only performed on dictionary objects.
Changes
Testing
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.