robotframework-requests
robotframework-requests copied to clipboard
Pass a list as expected_status
When targeting GET on a URI if its not found / internal server error results in exception HTTPError
, I can use the expected_status
to override it however, it would be great if that accepts multiple values
expected_status=400,500,200
Other use cases like where example,
GET On Session /xyz/somepath/uri expected_status=xxx
it would raise the HTTPError
if expected_status is not used and errors out
if the expected state mismatched, it raise exception as well
Url: https://xx.xx.xx.xx:443/xyz/openbmc_project/dump/ Expected status: 200 != 404
we would love to have the response than handle the exception in robot caller test code/scripts.
Thanks for the suggestion of passing multiple expected values, it could be an enhancement. I'm not sure I understood this instead:
we would love to have the response than handle the exception in robot caller test code/scripts.
If I understand properly you could specify expected_status='any' and then evaluate the response.
Right for improvement.. for instance, say may be a string or list of values
expected_status=[400, 500]
or
expected_status=200, 201
something in that line which user can input. this gives us the flexibility to be able to anticipate multiple valid return codes from the server.
plus if it doesn't get the expected status, we would want to get return response if errors/mismatched execrated status and not exception which is currently happening.
example:
resp= GET On Session /xyz/somepath/uri expected_status=201
resp
we would want this response if it errors/mismatched, but currently its throwing exception and not proceeding further a.
As said you could pass 'any' as expected status in order not to let the keyword fail.