Skip to main content
1

Create a test file

Create a file called api.http:
api.http
This file defines three requests:
  1. getPost — fetches a post, checks its fields, and captures the author’s ID
  2. createPost — creates a new post and checks the 201 response
  3. getAuthor — runs after getPost and uses the captured authorId to fetch the author
2

Run the tests

hitspec parses the file, executes each request in order (respecting dependencies), and evaluates all assertions.
3

See results

On success, you see a summary of passing tests:
If an assertion fails, hitspec shows exactly what went wrong:
The output tells you which assertion failed, on which line, what value was expected, and what was actually returned.

What Just Happened?

Let’s break down the key concepts from this example: Variables@baseUrl defines a reusable variable, referenced with {{baseUrl}}. Request separator### marks the start of each request. Metadata# @name, # @depends are directives that control behavior. Assertions — The >>> ... <<< block contains expect statements that validate the response. Captures — The >>>capture ... <<< block extracts values from responses (here, authorId) for use in later requests, referenced as {{getPost.authorId}}. Dependencies# @depends getPost ensures getAuthor runs after getPost, so the captured authorId is available.

Try it in studio

Prefer an interactive workflow? Open the same file in the terminal UI:
Studio lets you edit, run, and inspect requests in a tabbed response viewer, with dedicated screens for stress, mock, contract, record, history, and more — all keyboard-first. See the Studio guide.

Next Steps

Installation

Install hitspec via Homebrew, Go, or binary download.

Studio (Terminal UI)

Edit, run, and inspect requests interactively in the terminal.

Editor Setup

Get syntax highlighting and completions in your editor.

Core Concepts

Learn the file format, variables, assertions, and captures.
Last modified on July 13, 2026