Skip to content

Commit 19cfcee

Browse files
committed
fix: log_data response section needs to stay as an empty dictionary after sending it to ElasticSearch due to continuous StreamingResponse usage
1 parent cfbd258 commit 19cfcee

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

fastapi_elasticsearch_middleware/elasticsearch_middleware.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ async def intercept_send(response):
7474
log_data["response"]["body"] = str(response.get('body')) if 'body' in response.keys() else None
7575

7676
self.log_to_elasticsearch(log_data)
77-
log_data.clear()
77+
log_data["response"] = {}
7878

7979
if response['type'] == 'http.response.start': # Request part
8080

0 commit comments

Comments
 (0)