From cacf369435278d206ed5242113432109836cda29 Mon Sep 17 00:00:00 2001 From: default Date: Sat, 1 Jun 2024 19:31:45 +0200 Subject: [PATCH] [FIX] : patch odoo get_request from odoo.http, to allow '/oauth/userinfo' pass a GET request with application-type JSON --- galicea_openid_connect/controllers/main.py | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/galicea_openid_connect/controllers/main.py b/galicea_openid_connect/controllers/main.py index 423cac6..bfdf03d 100644 --- a/galicea_openid_connect/controllers/main.py +++ b/galicea_openid_connect/controllers/main.py @@ -410,3 +410,18 @@ class Main(http.Controller): response=None, status=302, ) + + +from odoo.http import Root, HttpRequest + +def patch_get_request(f): + # deduce type of request + def patched(self, httprequest): + if httprequest.path == "/oauth/userinfo" and httprequest.method == "GET": + return HttpRequest(httprequest) + return f(self, httprequest) + + return patched + + +Root.get_request = patch_get_request(Root.get_request)