Request Context
Request Context
Section titled “Request Context”Access request-scoped context values. Context is set via Funcs or Process.
Loading
Section titled “Loading”local ctx = require("ctx")Context Access
Section titled “Context Access”Get Value
Section titled “Get Value”local value, err = ctx.get("key")| Parameter | Type | Description |
|---|---|---|
key | string | Context key |
Returns: any, error
Get All Values
Section titled “Get All Values”local values, err = ctx.all()Returns: table, error
Errors
Section titled “Errors”| Condition | Kind | Retryable |
|---|---|---|
| Empty key | errors.INVALID | no |
| Key not found | errors.NOT_FOUND | no |
| No context available | errors.INTERNAL | no |
See Error Handling for working with errors.