RpcElixir.Middleware.Assign (elixir_ts_rpc v0.0.1)

Copy Markdown View Source

Built-in middleware that puts static values into ctx.assigns.

Useful for stamping a procedure with request-shape metadata (source channel, feature flag overrides, fixture data in tests) without touching the handler.

Usage

procedure "billing.charge", &MyApp.Billing.charge/2,
  middleware: [
    {RpcElixir.Middleware.Assign, source: :api, environment: :prod}
  ]

Each {key, value} pair in opts becomes an entry in ctx.assigns. Existing assigns under the same key are overwritten.