examples Start here
transport.http
Timeout, proxy, and @no-log samples. The timeout request fails on purpose, and the local mock stands in for the proxy.
start the local mock first
resterm _examples/transport.httpRun this from the root of a clone of the Resterm repository.
Editor
HTTP transport and settings docs# Start the mock in this file first with `resterm mock _examples/transport.http`,
# or open this file in the TUI and press `g Shift+M`.
### Fast Timeout
# @name TimeoutDemo
# @tag transport timeout
# @description Demonstrates @timeout to fail fast on slow responses.
# This request fails on purpose. The 2s timeout ends it before the 5s delay is over.
# @timeout 2s
GET {{base.url}}/delay/5
Accept: application/json
### Custom Transport Options
# @name CustomTransport
# @tag transport settings
# @description Shows proxy and redirect overrides.
# The local mock answers as the proxy, so example.invalid never has to resolve.
# @setting followredirects false
# @setting proxy {{transport.proxy}}
# @assert response.json().via == "resterm mock"
GET http://example.invalid/ping
Accept: */*
### Sensitive Payload With No Logging
# @name NoLogExample
# @tag transport privacy
# @description Prevents body snippets from landing in history.
# @no-log
# @setting timeout 4s
POST {{services.billing.base}}/secrets
Content-Type: application/json
Accept: application/json
{
"secret": "{{$uuid}}",
"source": "transport demo"
}
### Proxy reply
# @mock method=GET path=/ping
HTTP/1.1 200 OK
Content-Type: application/json
{"via":"resterm mock"}