Search code examples
odoo

Odoo controller receive blob


I need to send audio file from browser to python controller. Im doing it like this:

var xmlHttp = new XMLHttpRequest();
xmlHttp.open( "POST", "http://localhost:8069/my_controller/", false );
xmlHttp.send(blob);  // blob is Blob object with wav file

And on server side:

from odoo import http

class MyController(http.Controller):
    @http.route('/my_controller/', type='http', auth='public', methods=['POST'], csrf=False, cors="*")
    def my_controller(self, data=None, **kw):
        pass

I cant find a way to receive sent by XMLHttpRequest data. Will appreciate any help. Thanks.


Solution

  • from odoo.http import request
    data = request.httprequest.data