Source Events ↗

plugins.json_response_mutated

A JSON response body hook changed a response.

When
After json.response returns modified JSON.
Payload
JSON: { method, path, input_len, output_len }.
Cancelable
No

Fires only when output bytes differ from input bytes.

Use cases

  • Response enrichment
  • Compatibility shims

Example

Registration and handler

Register

hook!(host, PluginEvent::PluginJsonResponseMutated, on_json_body);

Handler

extern "C" fn on_event(ctx: *const EventContext) -> HookResult {
    let ctx = unsafe { &*ctx };
    let payload = unsafe { std::slice::from_raw_parts(ctx.payload_ptr, ctx.payload_len) };
    let _json = std::str::from_utf8(payload).unwrap_or_default();
    HookResult::r#continue()
}

← All lifecycle events