StrikekitStrikekit

api should

Assert last API response status, body, or JSON path

Assertions against the last HTTP response on the Platform: api session.

Forms

FormMeaning
api should status "<code>"Status code equals
api should body contain "<fragment>"Response body contains substring
api should json path "<path>" existgjson path exists
api should json path "<path>" be "<value>"gjson path string equals expected

Examples

Then I api should status "201"
And I api should body contain "book"
And I api should json path "$.id" exist
And I api should json path "$.item" be "book"
And I api should json path "$.id" be "@order-id"

Qualifiers

QualifierRole
statusExpected HTTP status code
body containSubstring in response body
json pathgjson-style path ($.id, …)
existPath must be present
bePath string equals expected (resolved)

Notes

  • JSON paths use gjson dialect.
  • Expected values in be / body contain / status go through shared resolve (whole-string @slot, $ENV, …).

On this page