Hi Nishan,
In the documentation fo POST you’ll see expected_status
By default this keyword fails if a status code with error values is returned in the response, this behavior can be modified using the
expected_status
andmsg
parameters, read more about it in Status Should Be keyword documentation. In order to disable this implicit assert mechanism you can pass asexpected_status
the valuesany
oranything
.
New requests keywords like GET or GET On Session (starting from 0.8 version) already have an implicit assert mechanism that, by default, verifies the response status code. Status Should Be keyword can be useful when you disable implicit assert using
expected_status=anything
.
You probably want something like this:
POST ${endpoint} json=${data} expected_status=401 headers=${headers} timeout=${TIMEOUT}
Then that keyword will pass and the following keywords will work as you want.
You can do the same with expected_status=400
and expected_status=500
as needed
Dave.