Assertions
PrismAssertResponse wraps an HTTP response with chainable assertion methods. Instead of manually checking status codes, headers, and body content, chain assertions for readable, expressive tests.
Quick Start
Chainable Assertions
Available Assertions
Status Code
Assert Status
Headers
Assert Headers
Body Content
Assert Body
JSON Decoding
Assert and Decode JSON
Chaining
Every assertion returnsself, so you can chain multiple checks:
Chain Everything
Reading the Body
Body Access
Complete Test Example
Full Test Suite
Error Types
Test Errors
Assertions use Swift’s
assert(), which is removed in release builds. For tests (which always run in debug mode), this is fine. If you need assertions in release builds, use precondition() or Swift Testing’s #expect.