Reputation: 445
I have a problem recovering an id at the end of executing a very simple request 1 of this type:
Given path "blah"
And header Authorization = "Bearer " + token
And request req
When method post
Then status 201
* def ts_id = response.id
Most of the time I recover the ts_id
well, but I have the impression that this is not always the case. Thus the request 2 which follows the request 1 and which needs the ts_id
returns an error 400.
The request 2 fails:
Given path 'toto', ts_id, 'tata'
And header Authorization = "Bearer " + token
And request req
When method post
Then status 200
Here'es the following error:
status code was: 400, expected: 200, response time in milliseconds: 118, url...
My test is very simple and has no overlap or external call I don’t know how to deal with this random problem. Thanks for help
Upvotes: 1
Views: 369
Reputation: 58088
Most likely this is because your first response is changing. There is no way to troubleshoot this unless you provide a way to replicate. Let me say that it is highly unlikely to be an issue with Karate.
That said, see if retry until
is the solution for your problem: https://stackoverflow.com/a/55823180/143475
Upvotes: 1