Assertions vs pre and post scripts

Published: (February 24, 2026 at 12:39 PM EST)
2 min read
Source: Dev.to

Source: Dev.to

Simple Assertions vs Pre & Post Requests

Many developers already use Assertions in Voiden to validate responses—checking status codes, verifying fields, or ensuring data formats.
They are great for simple validation and quick checks after a request.

But what if your workflow needs more than validation? That’s where Pre‑ & Post‑request scripts come in.

Pre‑ & Post‑request scripts illustration

Pre‑request scripts

Run before the request to:

  • Generate tokens
  • Set dynamic headers
  • Compute values
  • Inject variables
  • Prepare data on the fly

Post‑request scripts

Run after the response to:

  • Validate responses (beyond simple assertions)
  • Extract values and store variables
  • Trigger follow‑up logic
  • Chain multiple requests together

When to use Assertions

  • Simple checks and validations
  • Fast feedback
  • Lightweight workflows

When to use Pre‑ & Post‑request scripts

  • Dynamic APIs (e.g., token rotation)
  • Multi‑step flows and automated chaining
  • Scenarios requiring complex logic

Use assertions for quick checks and scripts for dynamic, automated workflows.

Voiden now supports JavaScript and Python for Pre‑ & Post‑request scripts (available in the beta).

Question for the community: Which other languages would you like to see supported in Voiden? Your feedback could shape the next updates!

Beta download:
GitHub repository:

0 views
Back to Blog

Related posts

Read more »