Skip to main content

Assertion Blocks

Assertions help you double-check that your API is behaving itself. Think of them as little guards that say, “Hey response… are you sure you’re correct?”
Voiden proudly supports Assertions as a reusable block, because why should only your code get superpowers?

Note: Make sure the Assertion Plugin is enabled — without it, your assertions are basically on vacation.


How to Use the Assertion Block

  1. Add the Block
    Type /assertion-block and—poof!—your assertion template appears like a magician’s trick (minus the smoke).

assertion

  1. Run It
    Give your request a gentle nudge by either:

    • Pressing Cmd + Enter (on macOS) or Ctrl + Enter (on Windows/Linux), or
    • Clicking the big, bright green Play button—the one that screams “press me!”
  2. Check the Results
    Slide over to the Response Panel — you’ll spot your shiny new Assertion Check waiting to tell you if things went perfectly… or hilariously wrong.

asserion


Available Operators

OperatorAliasesDescription
equalseq, ==, ===Exact equality
not-equalsne, !=, !==Not equal
containsincludesString contains
not-containsnot-includesString does not contain
starts-withstartswithString starts with
ends-withendswithString ends with
matchesregexRegex pattern match
existsis-definedValue exists
not-existsis-null, is-undefinedValue does not exist
greater-thangt, >Greater than (numeric)
less-thanlt, <Less than (numeric)
greater-equalgte, >=Greater or equal (numeric)
less-equallte, <=Less or equal (numeric)
is-emptyemptyEmpty array/string/object
not-emptyNoneNot empty
is-truthytruthyTruthy value
is-falsyfalsyFalsy value
type-istypeofType check

Available fields

FieldExample
status200
statusTextOK
responseTime500
duration1000
headerheader.Content-Type might have applcation/json
bodybody.data[0].id would read the id from { "data": [ { "id": 0} ] }

Summary

Assertion blocks are your API's quality check — drop one in with /assertion-block, run your request, and head over to the Response Panel to see exactly what passed and what didn't. You can check status codes, status text, response time, headers, and body fields, with a solid set of operators covering everything from simple equality to regex matching and type checks. Just make sure the Assertion Plugin is enabled and you're good to go.