Hi,
When querying a Rest API the result may be juste an empty array
[]
How to check if the arry is empty and if not fetch the first element. I’m success do this when the array is not empty with
.check(status.in(200), jsonPath("$[0].id").saveAs( "firstdocid" ))
But indeed this fails with 0 element.
Appreciate some help on this point.
Regards
Use optional instead of default exist
Is there any sample about optionnal in the doc ? I did find anything on 2.1.2 version
Thanks
So as I understand this will work
header("Etag").dontValidate.saveAs("Etag")))
but
dontValidate
is not usable with jsonPath as
jsonPath("$[0].id").dontValidate.saveAs( "firstdocid" )
Or did I miss something ?
Chech the documentation: dontValidate has been renamed to optional.