| name | treq |
| description | t-req.io API testing - CLI reference, SOPs, and syntax |
t-req CLI Reference
treq run
treq run <file.http> [options]
| Option | Alias | Description |
|---|
--name | -n | Select request by @name |
--profile | -p | Config profile from treq.jsonc |
--var | -v | Variables as key=value |
--verbose | | Detailed output |
Examples:
treq run collection/users/get.http --verbose
treq run collection/auth/login.http -p dev
SOPs
Add a New API
- Create Zod schema:
schemas/<name>.ts
- Create HTTP file:
collection/<name>/<action>.http with # @name
- Quick test:
treq run collection/<name>/<file>.http --verbose
- Create test:
tests/<name>.test.ts with .parse() validation
- Full verify:
bun run test
Fix a Failing Test
bun run test to see failure
treq run <file>.http --verbose to see raw response
- Compare Zod schema to actual response
- Update schema or
.http file
bun run test to confirm
Syntax
- Variables:
{{var}} or {{nested.path}}
- Resolvers:
{{$uuid()}}, {{$timestamp()}}, {{$env(NAME)}}
- File injection:
< ./path/to/file.json