Skip to content

Optimize response body handling in logging middleware #156

@coderabbitai

Description

@coderabbitai

Currently, the logging middleware uses json.loads(response.body) to parse the response body for logging purposes. This approach is inefficient as it requires reading and parsing the response stream.

Proposed Solution

Use a custom response class to store the original response data, avoiding the need to re-parse the JSON. This can be implemented following the approach discussed in this FastAPI discussion.

References

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions