.http File Format
@t-req/core uses the standard .http file format, compatible with VS Code REST Client and JetBrains HTTP Client.
Basic Structure
Section titled “Basic Structure”### Request Name# @name requestId# @description Optional descriptionMETHOD https://example.com/pathHeader-Name: Header-Value
Request body hereRequest Separators
Section titled “Request Separators”Requests are separated by ###:
### First RequestGET https://api.example.com/users
###
### Second RequestPOST https://api.example.com/usersContent-Type: application/json
{"name": "John"}Request Names
Section titled “Request Names”Request names can be specified two ways:
### Get All UsersGET https://api.example.com/users
#### @name getUserByIdGET https://api.example.com/users/1Comments
Section titled “Comments”Comments start with # or //:
# This is a comment// This is also a commentGET https://api.example.com/usersMeta Directives
Section titled “Meta Directives”Meta directives provide additional request metadata:
# @name myRequest# @description Fetches user data# @timeout 5000GET https://api.example.com/usersHeaders
Section titled “Headers”Headers follow the request line, one per line:
GET https://api.example.com/usersAuthorization: Bearer {{token}}Accept: application/jsonContent-Type: application/jsonX-Custom-Header: custom-valueRequest Body
Section titled “Request Body”The body starts after an empty line following the headers:
POST https://api.example.com/usersContent-Type: application/json
{ "name": "{{name}}", "email": "{{email}}"}Variables
Section titled “Variables”Variables use {{variable}} syntax:
GET https://{{baseUrl}}/users/{{userId}}Authorization: Bearer {{token}}See Variables for more details.
File References
Section titled “File References”Load request body from an external file:
POST https://api.example.com/dataContent-Type: application/json
< ./fixtures/payload.jsonThe file path is relative to the .http file location.
Form Data
Section titled “Form Data”Simple syntax for forms and file uploads:
POST https://api.example.com/upload
title = Quarterly Reportdescription = Q4 2025 summarydocument = @./reports/q4-2025.pdfSyntax:
field = value— text fieldfield = @./path— file uploadfield = @./path | custom.pdf— file with custom filename (spaces around|required)
Content-Type is inferred:
- Files present →
multipart/form-data - Text only →
application/x-www-form-urlencoded
Detection rules:
- All lines must match
name = valuepattern to be parsed as form data - Single-line body with
&is treated as pre-encoded URL string - Setting
Content-Type: application/jsonortext/plaindisables form parsing
See Form Data Guide for detailed examples.
Best Practice: One Request Per File
Section titled “Best Practice: One Request Per File”For testability and clarity, we recommend one request per file:
requests/├── auth/│ ├── login.http│ ├── logout.http│ └── refresh.http├── users/│ ├── create.http│ ├── get.http│ ├── update.http│ └── delete.http└── orders/ ├── create.http └── list.httpThis makes each request independently executable and testable.
Format Rules Summary
Section titled “Format Rules Summary”| Element | Syntax |
|---|---|
| Request separator | ### |
| Request name | ### Name or # @name name |
| Comment | # or // |
| Meta directive | # @key value |
| Variable | {{variable}} |
| File reference | < ./path/to/file |
| Form field | field = value |
| File upload | field = @./path |