Skip to main content

Module exit_transformer

Module exit_transformer 

Source
Expand description

The exit-transformer node — reshapes gateway-generated responses (“exits”: auth rejections, rate-limit denials, upstream failures, …) with a status-code remap and a body template. Reinterpreted subset of APISIX’s exit-transformer plugin (response-phase: place after upstream, before client).

This is a deliberate reinterpretation, not a faithful port. APISIX’s plugin registers user-supplied Lua functions that receive (code, body, headers) and return replacements. Arbitrary scripted transformation belongs to featherbit’s script node; this node keeps the declarative core of the idea:

  • status_map remaps exit status codes (e.g. hide a 502 as a 503), and
  • body renders a $var template (including $status) as the new body,

applied only to responses the gateway itself generated (heuristic: Context.errors non-empty), or unconditionally with always: true.

Structs§

ExitTransformerPlugin
Remaps Context.response.status_code via status_map and/or replaces the body with an interpolated $var template — but only when the response was generated by the gateway (Context.errors non-empty), unless always is set. This plugin never fails at execution time.

Functions§

parse_status 🔒
Validates one status code (map key or value): an integer within 100-599.