Closed Caritrian closed 5 years ago
Would fix, as well as if isinstance(body, (dict)) and dict:
. The dict is True
if not empty, False
if empty. Very good and thanks for a detailed issue report!
I had to double-check that according to the commit history I already fixed this 17 days ago. I ended up checking there is no key properties
in the generated schema: I thought it is more readable, though longer, but the logic is essentially the same.
Just released rc3 where this fix is included. Leaving this open for a while, in case the issue continues to persist.
Hi
Thx I will have a look.
Br Kev
Assuming this fixed - please reopen if the issue persists.
Hi @asyrjasalo
At work i am currently facing some problems with your library. I found out after a post request to our internal rest interface a 200 OK was responded with an empty body { }. This is of course also a defect on our side but leads to an error in robotframework:
KeyError: u'properties' Traceback (most recent call last): File "C:\Anaconda3\envs\py2_automation\lib\site-packages\REST\keywords.py", line 404, in post return self._request(endpoint, request, validate)['response'] File "C:\Anaconda3\envs\py2_automation\lib\site-packages\REST\keywords.py", line 1229, in _request instance = self._instantiate(request, response, validate) File "C:\Anaconda3\envs\py2_automation\lib\site-packages\REST\keywords.py", line 1257, in _instantiate self._add_defaults_to_schema(schema, response) File "C:\Anaconda3\envs\py2_automation\lib\site-packages\REST\keywords.py", line 1293, in _add_defaults_to_schema self._add_property_defaults(body, schema['properties'])
I changed the code locally to test if this is working,..
in keywords.py, line 1289
this was changed to
in case of empty body.
How do you think about it? BR Kev