Skip to content

Scripting & Testing

Feature VS CodeJetBrainshttpyacVS 2022kulala
Response handler scripts (> {% %}) httpyac supports for JetBrains compatibility. ✗ ✓ ✓ ✗ ✓
Response handler scripts ({{ }}) httpyac-native syntax with full Node.js require() access. ✗ ✗ ✓ ✗ ✗
Pre-request scripts (< {% %}) ✗ ✓ ✗ ✗ ✓
Pre-request scripts ({{ }} before request) ✗ ✗ ✓ ✗ ✗
Assertion syntax (?? status == 200) Supports status, header, body, duration, js, xpath assertions. ✗ ✗ ✓ ✗ ✗
client.test() API ✗ ✓ ✓ ✗ ✓
Crypto API in scripts crypto.hmac.sha256(), crypto.sha256(), etc. ✗ ✓ ✗ ✗ ✗
Lua scripting > {% --lua ... %}. Unique to kulala.nvim. ✗ ✗ ✗ ✗ ✓
External response handler file (> filepath.js) ✗ ✓ ✗ ✗ ✗
Event-specific script hooks {{@request}}, {{@streaming}}, {{@response}}, {{@responseLogging}}, {{@after}}. ✗ ✗ ✓ ✗ ✗
Global script registration ({{+...}}) Registers scripts to execute across all requests. {{+after}} runs after every request. ✗ ✗ ✓ ✗ ✗
Built-in test helpers (test.status(), test.header()) test.status(), test.totalTime(), test.header(), test.headerContains(), test.responseBody(), etc. ✗ ✗ ✓ ✗ ✗

The most significant split in the .http ecosystem is between clients that support scripting and those that don't:

Limited Support Supported by 2 implementations.

VS Code REST Client and Visual Studio 2022 offer no scripting at all. Response data is accessed only through named request variables (dot-path syntax). There are no assertions, no pre-request logic, no response handlers.

The JetBrains response handler syntax has become the de facto standard for scripting — adopted by httpyac (for compatibility) and kulala.nvim.

JetBrains
GET https://api.example.com/users

> {%
client.test("Status is 200", function() {
  client.assert(response.status === 200);
});
client.global.set("count", response.body.length);
%}
httpyac (JetBrains compat)
GET https://api.example.com/users

> {%
client.test("Status is 200", function() {
  client.assert(response.status === 200);
});
%}
httpyac (native)
GET https://api.example.com/users

{{
const { equal } = require('assert');
test('status is 200', () => {
  equal(response.statusCode, 200);
});
}}
httpyac (assertions)
GET https://api.example.com/users

?? status == 200
?? header content-type includes json
?? duration < 500

httpyac supports JetBrains scripts for compatibility but adds:

  • Native double-brace blocks with full Node.js require() access
  • ?? assertion syntax for concise, readable tests
  • Event hooks for request, streaming, response, and after events

kulala.nvim uniquely supports Lua alongside JavaScript in response handler scripts.

Syntax details: Response Handlers, Pre-Request Scripts.