We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 64ba980 commit 6668a76Copy full SHA for 6668a76
fastapi_elasticsearch_middleware/elasticsearch_middleware.py
@@ -74,6 +74,7 @@ async def intercept_send(response):
74
log_data["response"]["body"] = str(response.get('body')) if 'body' in response.keys() else None
75
76
self.log_to_elasticsearch(log_data)
77
+ log_data.clear()
78
79
if response['type'] == 'http.response.start': # Request part
80
@@ -134,7 +135,6 @@ async def intercept_receive():
134
135
def log_to_elasticsearch(self, log_data) -> None:
136
try:
137
self.elasticsearch_client.index(index=self.index, body=log_data)
- log_data["response"] = {}
138
except Exception as e:
139
logging.error(f"Failed to log to Elasticsearch: {str(e)}")
140
0 commit comments