'Error- Validate Multiple APi call response in one scenario in karate

I am trying to use two api call (Post & put call) in one scenario in karate framework. But I am not able to validate 2nd Api call response. when i tried to do like response.id , it passing 1 st api call response.

Is there any solution for it?



Solution 1:[1]

In your feature file, you wrote your print response in When instead of writing it after Then. Which means it is showing the previous response only. As per documentation response gets overridden after making a new http request.

Following,

...
When method put
And print 'jokerresult-->',response.joker_result
Then status 201

Should be like,

...
When method put
Then status 201
And print 'jokerresult-->',response.joker_result

let me know if it worked for you or not.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1