OCA / odoorpc

Python module to pilot your Odoo servers through JSON-RPC.
http://pythonhosted.org/OdooRPC/
GNU Lesser General Public License v3.0
231 stars 124 forks source link

missing the tail truncation URL prior to assembly in a full URL in class ProxyHTTP #24

Closed BuxoyTuxlik closed 6 years ago

BuxoyTuxlik commented 6 years ago

https://github.com/OCA/odoorpc/blob/bfecb7ff3c3df925f94400adc26ecea89dbc3db8/odoorpc/rpc/jsonrpclib.py#L102-L107

add befor line 102:

if url.startswith('/'):
        url = url[1:]

because if you call the controller in this form:

odoo.http('/web/test_route/api/v0.1/get_po?external_id=9999')

we get an incorrect URL with an extra "//":

"GET //web/test_route/api/v0.1/get_po?external_id=9999 HTTP/1.0" 404 -
pedrobaeza commented 6 years ago

I think you should remove it in your code, not adding this exceptional case in library.

sebalix commented 6 years ago

@pedrobaeza in fact this case is supported for JSON requests here: https://github.com/OCA/odoorpc/blob/master/odoorpc/rpc/jsonrpclib.py#L86 But it appears that it's not the case for raw HTTP requests. It has to be fixed.

pedrobaeza commented 6 years ago

OK, I don't like too much that kind of adjustments that can be done on the other side, but if you think so...

sebalix commented 6 years ago

Well, maybe it was a bad design when I wrote this (I don't remember why it was done), but I prefer a coherent behavior among HTTP and JSON requests instead of removing this feature from JSON requests. I'll look in detail.

BuxoyTuxlik commented 6 years ago

@sebalix Оk, thanks!