I'd like to accept and respond to JSON requests in Odoo from sources that may be out of my control. The reason this is not straightforward is because Odoo is forcing me to use JSON-RPC, which is not suitable for the source I'm interacting with.
For example, if I set the route type to "http" in the `@http.route` decorator, Odoo rejects the request if the mimetype is "application/json" but the body has no content. This isn't going to work in my case because I may not be able to choose what the other source sends to me. Additionally, I am unable to send back a custom JSON response unless the incoming request doesn't have the "application/json" mimetype, which again is not in my control.
I have done a lot of searching on the internet and read much of Odoo's HTTP source code. The "solution" I keep seeing everywhere is to monkey patch the `JsonRequest` class one way or another. This allows me to indeed respond with whatever I want, however it doesn't allow me to accept whatever the service may send me.
One specific case I need to be able to handle is incoming "application/json" GET requests with no body. How can I achieve this despite Odoo's heavy handed JSON-RPC handing?
Hope these resources will help:
1- https://learnopenerp.blogspot.com/2021/09/authenticate-api-for-odoo-postman-advance-rest-client.html
2- https://learnopenerp.blogspot.com/2018/08/odoo-web-controller.html
3- https://learnopenerp.blogspot.com/2018/06/odoo-get-web-form-template-value-in-controller.html
None of the resources are helpful. However, the source of the OCA `base_rest` module has some clues at how this could be solved.