Skip to content

Commit

Permalink
[FIX] rest_log: result is not always a json
Browse files Browse the repository at this point in the history
  • Loading branch information
lmignon authored and sbejaoui committed Dec 12, 2023
1 parent 126d60d commit abda1ab
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion rest_log/components/service.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
import traceback

from werkzeug.urls import url_encode, url_join
from werkzeug.wrappers import Response

from odoo import exceptions, registry
from odoo.http import request
Expand Down Expand Up @@ -125,6 +126,10 @@ def _log_call_in_db_values(self, _request, *args, params=None, **kw):
params = self._log_call_sanitize_params(params)

result = kw.get("result")
if isinstance(result, Response):
result = {"content": "Binary response"}
else:
result = json_dump(result)
error = kw.get("traceback")
orig_exception = kw.get("orig_exception")
exception_name = None
Expand All @@ -142,7 +147,7 @@ def _log_call_in_db_values(self, _request, *args, params=None, **kw):
"request_method": httprequest.method,
"params": json_dump(params),
"headers": json_dump(headers),
"result": json_dump(result),
"result": result,
"error": error,
"exception_name": exception_name,
"exception_message": exception_message,
Expand Down

0 comments on commit abda1ab

Please sign in to comment.