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

Requirements

ItemContract
Element / control shapeNone — HTTP session (Platform: api)
How the label bindsPath / body / headers are payloads ($ENV, slots expand)
Qualifiers that change resolveSee this command’s Qualifiers table
PlatformPlatform: api only — requires $API_BASE_URL (and auth env as needed)
Wrong shape → use insteadUI XHR wait → wait for response. Browser UI → web commands

See also UI contracts and Platform: api.

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