Skip to content

Commit

Permalink
[FIX] fastapi: Compatibility with latest Odoo
Browse files Browse the repository at this point in the history
From odoo/odoo@cb1d057, the orignal werkzeug request is wrapped in a dedicated class to keep under control the attributes developers use. This change add code to make the fastapi addon working with version including this last change and prior version

refs #414
  • Loading branch information
lmignon committed Feb 20, 2024
1 parent 443b800 commit 9e92d87
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions fastapi/fastapi_dispatcher.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,11 @@ def _make_response(self, status_mapping, headers_tuple, content):
self.headers = dict(headers_tuple)

def _get_environ(self):
environ = self.request.httprequest.environ
environ["wsgi.input"] = self.request.httprequest._get_stream_for_parsing()
httprequest = self.request.httprequest
if hasattr(httprequest, "_HTTPRequest__wrapped"):
httprequest = httprequest._HTTPRequest__wrapped
environ = httprequest.environ
environ["wsgi.input"] = httprequest._get_stream_for_parsing()
return environ

@contextmanager
Expand Down

0 comments on commit 9e92d87

Please sign in to comment.