rest-framework
rest-framework copied to clipboard
[IMP] rest_log: handle odoo.http.Response objects in logs
Handle odoo.http.Response objects when creating logs.
Hi @simahawk, some modules you are maintaining are being modified, check this out!
Handle
odoo.http.Responseobjects when creating logs.
Can you please explain what you are trying to achieve? Also, rebase and drop the change on README.md.
@simahawk
Some endpoints will not return a dict as expected by the _dispatch_with_db_logging method (and the other methods called within), but an object of type odoo.http.Response.
When that happens, the instance fails to handle it while creating logs (ie: tries to call json.dumps() on such object, which is not allowed).
This patch should fix the issue.
@simahawk
Some endpoints will not return a dict as expected by the
_dispatch_with_db_loggingmethod (and the other methods called within), but an object of typeodoo.http.Response. When that happens, the instance fails to handle it while creating logs (ie: tries to calljson.dumps()on such object, which is not allowed). This patch should fix the issue.
This should be the description of the commit :wink: You can also shorten the message by removing "in logs" which is redundant for "rest_log".
@simahawk
Added headers to result, also added unit tests.
Mind taking a look again? :sweat_smile:
/ocabot merge minor
What a great day to merge this nice PR. Let's do it! Prepared branch 13.0-ocabot-merge-pr-296-by-simahawk-bump-minor, awaiting test results.
This PR has the approved label and has been created more than 5 days ago. It should therefore be ready to merge by a maintainer (or a PSC member if the concerned addon has no declared maintainer). 🤖
Congratulations, your PR was merged at cddd0ae7757a8b65af0814fb13a37baec344fb1d. Thanks a lot for contributing to OCA. ❤️