.http file format with assertion capabilities, enabling you to write executable HTTP requests that validate API responses automatically.
File Extensions
HTTPSpec supports two file extensions:.httpspec- The recommended extension for HTTPSpec files.http- Standard HTTP file format, also supported for compatibility
.http and .httpspec files when you run it against a directory.
Basic Structure
Each HTTPSpec file contains one or more request blocks. A request block consists of:- Optional name - A comment starting with
###to describe the test - Request line - HTTP method, URL, and optional HTTP version
- Headers - Key-value pairs for HTTP headers
- Request body - Optional body content (JSON, XML, etc.)
- Assertions - Lines starting with
//#that validate the response
Multiple Requests
You can include multiple request blocks in a single file, separated by blank lines or test names. HTTPSpec executes them sequentially, which is useful for:- Setup and teardown operations
- Testing request sequences
- Grouping related API tests
Multiple Requests
Requests are executed in the order they appear in the file.
Learn More
Request Format
Detailed syntax for HTTP requests, headers, and bodies
Assertions
How to write assertions to validate responses
Variables
Use variables for dynamic values in requests
Assertion Types
All available assertion operators and examples