Templates#

With template: true on a response, Simuhook renders the response body and header values as Go templates, injecting request-specific data into every response.

PageWhat it covers
VariablesRequest data available inside a template: .UUID, .Now, .Body, and more.
FunctionsHeader, Query, RandomInt, RandomHex.
Faker Generators27 realistic random data generators: names, addresses, payment details, and more.
JSONPathExtract fields from the JSON request body with {{JSONPath "$.user.name"}}.

Quick Example#

id: order-created
method: POST
path: /webhooks/orders
response:
  status_code: 200
  template: true
  headers:
    X-Request-ID: "{{.RequestID}}"
    X-Timestamp: "{{.Now}}"
  body: '{"id":"{{.UUID}}","event":"order.created","timestamp":{{.Timestamp}},"method":"{{.Method}}","body":"{{.Body}}"}'

Every request gets a fresh UUID, timestamp, and the request’s own method and body echoed back.