Rext HTTPSmart HTTP Client for VS Code — Write 🌐 Website: getrext.com ¿Qué hace a Rext diferente?A diferencia de los archivos ✨ Features📝 Human-Readable SyntaxCada request se separa con
Métodos soportados:
⚡ One-Click ExecutionRun any request with � Directivas
|
| Scope | Prefix | Persistence |
|---|---|---|
| Session | @capture varName |
In-memory only |
| Collection | @capture collection.varName |
.rext.collection.json |
| Environment | @capture env.varName |
rext.env.json |
| Global | @capture global.varName |
VS Code settings |
Valores literales:
@capture session.status = "active"
@capture session.count = 42
@capture session.flag = true
🔄 Pre-Requests
@pre — Ejecuta peticiones previas
Referencia un @id para ejecutar esa petición antes de la actual. Los @capture de la pre-request setean variables disponibles para la request principal.
###
@id abc123
@name Login
POST {{baseUrl}}/auth/login
@capture env.token = body.access_token
###
@name Get Profile
@pre abc123
GET {{baseUrl}}/profile
Authorization: Bearer {{token}}
Múltiples @pre permitidos (ejecución secuencial):
@pre abc123
@pre def456
@name Full Flow
GET {{baseUrl}}/dashboard
Protección contra ciclos: si A tiene
@pre By B tiene@pre A, la cadena se detiene automáticamente.
✅ Assertions
@assert — Validaciones de respuesta
Valida condiciones sobre la respuesta. Si falla, se muestra ❌ en el panel de resultados.
Targets
| Target | Descripción | Ejemplo |
|---|---|---|
status |
Código HTTP | @assert status == 200 |
body |
Cuerpo (JSON path) | @assert body.success == true |
header |
Headers de respuesta | @assert header.content-type contains application/json |
duration |
Tiempo de respuesta (ms) | @assert duration < 2000 |
size |
Tamaño de respuesta (bytes) | @assert size < 10240 |
cookie |
Cookies del response | @assert cookie.sessionId exists |
Operadores de Comparación
| Operador | Descripción | Ejemplo |
|---|---|---|
== |
Igual a | @assert status == 200 |
!= |
Diferente a | @assert status != 500 |
> |
Mayor que | @assert body.items.length > 0 |
< |
Menor que | @assert duration < 2000 |
>= |
Mayor o igual | @assert status >= 200 |
<= |
Menor o igual | @assert status <= 299 |
contains |
Contiene texto | @assert body.name contains John |
Operadores de Tipo y Existencia
| Operador | Descripción | Ejemplo |
|---|---|---|
exists |
Existe (no null/undefined) | @assert body.token exists |
!exists |
No existe | @assert body.error !exists |
isArray |
Es un array | @assert body.data isArray |
isNumber |
Es numérico | @assert body.count isNumber |
isNull |
Es null | @assert body.deletedAt isNull |
isUndefined |
Es undefined | @assert body.debug isUndefined |
isEmpty |
Está vacío | @assert body.errors isEmpty |
Ejemplo completo
###
@name Create User
POST {{baseUrl}}/users
Content-Type: application/json
{
"name": "John",
"email": "john@example.com"
}
@assert status == 201
@assert body.id exists
@assert body.name == John
@assert body.email contains @
@assert body.roles isArray
@assert header.content-type contains application/json
@assert duration < 3000
@assert size < 5120
🔁 Reintentos y Timeout
@retry — Reintentos automáticos
Reintenta en caso de error 5xx. Opcionalmente con delay.
@retry 3
@name Flaky Request
GET {{baseUrl}}/unstable-endpoint
@retry 5 delay 1000
@name Critical Request
POST {{baseUrl}}/payment
@timeout — Timeout de la petición (ms)
@timeout 5000
@name Slow Request
GET {{baseUrl}}/heavy-report
⚙️ Configuración
@config — Configuración compartida
Define valores por defecto que aplican a todas las peticiones del archivo.
@config
baseUrl: https://api.example.com
timeout: 5000
retries: 2
headers:
Content-Type: application/json
Accept: application/json
assert:
status == 200
Config por colección
@config
collection: Auth API
baseUrl: https://auth.example.com
headers:
X-API-Key: {{apiKey}}
Herencia y Override
- baseUrl: se antepone a URLs relativas (que empiezan con
/) - headers: merge (request sobreescribe config)
- timeout / retries: se aplican si el request no los define
- assertions: se acumulan (config + request)
🌍 Environment Management
Cambia entre entornos (development, staging, production) seamlessly. Define variables en rext.env.json:
{
"Development": {
"baseUrl": "http://localhost:3000",
"apiKey": "dev-key-123"
},
"Production": {
"baseUrl": "https://api.production.com",
"apiKey": "prod-key-456"
}
}
Cambia de entorno con Rext: Switch Environment desde el command palette o la barra de estado.
🧩 Editor Experience
- Syntax Highlighting — Full TextMate grammar for
.rextfiles - IntelliSense — Auto-completion for directives, methods, headers, and variables
- CodeLens — Run buttons inline above each request
- Inlay Hints — Visual feedback for captured variables and auto-generated IDs
- Diagnostics — Warnings for duplicate IDs, syntax errors, and more
- Quick Fixes — Auto-generate missing
@iddirectives - Snippets — Quick scaffolding for common patterns
Response Panel
View responses in a dedicated panel with:
- Formatted JSON body with syntax highlighting
- Response headers
- Status code, timing, and size
- Assertion results (✅ pass / ❌ fail)
- Captured variables
Sidebar
Dedicated activity bar panel showing your request history and workspace .rext files.
🔀 Git Friendly
.rext files are plain text — perfect for version control. Share request collections with your team via Git.
📋 Snippets
| Prefix | Description |
|---|---|
get |
GET request with name |
post |
POST request with JSON body |
name |
@name directive |
cap |
Capture variable (session) |
capcol |
Capture variable (collection) |
capenv |
Capture variable (environment) |
capglobal |
Capture variable (global) |
flow |
Complete login + authenticated request flow |
as |
Assert status code |
ab |
Assert body value |
retry |
Retry with delay |
⌨️ Keyboard Shortcuts
| Shortcut | Action |
|---|---|
Ctrl+Enter / ⌘+Enter |
Run current request |
🚀 Commands
| Command | Description |
|---|---|
Rext: Run Current Request |
Execute the request at cursor position |
Rext: Run All Requests in File |
Execute all requests in the active file |
Rext: Switch Environment |
Change the active environment |
🔮 Ejemplo Completo
@config
baseUrl: https://api.example.com
headers:
Content-Type: application/json
assert:
status >= 200
###
@id a1b2c3
@collection Auth
@name Login
POST /auth/login
{
"email": "{{email}}",
"password": "{{password}}"
}
@capture env.token = body.access_token
@assert status == 200
@assert body.token exists
@assert duration < 2000
###
@collection Auth
@name Get Profile
@pre a1b2c3
GET /profile
Authorization: Bearer {{token}}
@assert status == 200
@assert body.email exists
@assert body.roles isArray
@assert header.content-type contains json
📦 Installation
- Open VS Code
- Go to Extensions (
Ctrl+Shift+X) - Search for "Rext HTTP"
- Click Install
Or install from:
📖 Specification
Rext is built on an open specification. Learn more at github.com/Rext-Labs/rext-spec.
🔗 Links
- 🌐 Website: getrext.com
- 📖 Spec: github.com/Rext-Labs/rext-spec
- 🛒 VS Code Marketplace: marketplace.visualstudio.com
- 🟢 Open VSX: open-vsx.org
- 🐛 Issues: github.com/Rext-Labs/rext-vscode/issues
- 🏢 Organization: github.com/Rext-Labs
📄 License
MIT — see LICENSE for details.