Skip to content

assignAttributes

const assignAttributes: (config) => Policy

Defined in: src/policies/transform/assign-attributes.ts:43

Set key-value attributes on the Hono request context.

AssignAttributesConfig

Must include attributes - a record of keys to values or resolver functions.

Policy

A Policy at priority 50 (REQUEST_TRANSFORM).

import { assignAttributes } from "@homegrower-club/stoma";
assignAttributes({
attributes: {
"x-tenant": "acme",
"x-request-path": (c) => new URL(c.req.url).pathname,
},
});