What's New
Some nice improvements shipping in this release. HTTP version handling got a solid upgrade, and RestermScript modules are now easier to organize and debug.
HTTP Version Control
You can now tell Resterm exactly which HTTP version to use for your requests. Just add a trailing version to your request line or use the settings directive:
Force HTTP/1.1
GET https://api.example.com/users HTTP/1.1
Or via settings
# @setting http-version 1.1
POST https://api.example.com/data
Supported values are 1.0, 1.1, and 2 (or more verbose HTTP/1.0, HTTP/1.1, HTTP/2 forms). When you pick version 2, Resterm enforces it strictly - if the server doesn't speak HTTP/2, you'll get an error instead of a silent downgrade (strict validation).
Also added extra guard:
- HTTP/2 over plain http:// (h2c) isn't supported and will error early.
RestermScript Module Improvements
Modules now support a top-level module declaration, which lets you skip the as alias when importing, so now you can either still use as helpers and skip module declaration, or specify module <name> in RTS scripts like this:
# helpers.rts
module helpers
export fn authHeader(token) {
return token ? "Bearer " + token : ""
}
and then in your .http file:
# @use ./rts/helpers.rts
and then referance like:
Authorization: {{= helpers.authHeader(vars.get("auth.token")) }}
The parser now validates @use imports upfront before your request runs. If two modules try to claim the same alias, or if you forget the module declaration when importing without as, you'll get a clear error pointing to the exact line.
Under The Hood
Like always - usual small code refactor and improvements.