Request
$bolt.method()
Get HTTP method.
m = $bolt.method() # "GET", "POST", etc.$bolt.path()
Get request path (route pattern).
p = $bolt.path() # "/users/:id" (route pattern, not actual URI)$bolt.uri()
Get raw request URI (actual path including query string).
u = $bolt.uri() # "/users/123?tab=profile"$bolt.param(cName)
Get URL parameter.
# Route: /users/:id
id = $bolt.param("id")$bolt.query(cName)
Get query string parameter (first value if multi-valued).
# URL: /search?q=hello&page=1
q = $bolt.query("q") # "hello"
page = $bolt.query("page") # "1"$bolt.queryAll(cName)
Get all values for a query parameter as a list. Useful for ?tag=rust&tag=web patterns.
# URL: /search?tag=rust&tag=web
tags = $bolt.queryAll("tag") # ["rust", "web"]$bolt.header(cName)
Get request header.
auth = $bolt.header("Authorization")
contentType = $bolt.header("Content-Type")$bolt.body()
Get raw request body as string (lossy UTF-8 — binary bytes replaced with U+FFFD).
raw = $bolt.body()$bolt.bodyBase64()
Get raw request body as base64-encoded string (binary-safe).
encoded = $bolt.bodyBase64()$bolt.base64Decode(cStr)
Decode a base64-encoded string.
decoded = $bolt.base64Decode("aGVsbG8gd29ybGQ=") # "hello world"$bolt.base64Encode(cStr)
Encode a string as base64.
encoded = $bolt.base64Encode("hello world") # "aGVsbG8gd29ybGQ="$bolt.base64UrlEncode(cStr)
Encode a string as URL-safe base64.
encoded = $bolt.base64UrlEncode("hello world") # "aGVsbG8gd29ybGQ"$bolt.base64UrlDecode(cStr)
Decode a URL-safe base64-encoded string.
decoded = $bolt.base64UrlDecode("aGVsbG8gd29ybGQ") # "hello world"$bolt.jsonBody()
Parse request body as JSON.
data = $bolt.jsonBody()
name = data[:name]$bolt.formField(cName)
Get form field value from multipart form data (first value if multi-valued).
username = $bolt.formField("username")
password = $bolt.formField("password")$bolt.formFieldAll(cName)
Get all values for a form field as a list. Useful for checkbox arrays and multi-select inputs.
# <input type="checkbox" name="hobby" value="reading">
# <input type="checkbox" name="hobby" value="coding">
hobbies = $bolt.formFieldAll("hobby") # ["reading", "coding"]$bolt.requestId()
Get unique request ID.
id = $bolt.requestId() # "550e8400-e29b-41d4-a716-446655440000"$bolt.clientIp()
Get client IP address.
ip = $bolt.clientIp() # "192.168.1.100"