vane 0.9.0

A flow-based reverse proxy with multi-layer routing and programmable pipelines.
---
title: Send Response
description: The final phase of the L7 request lifecycle.
icon: Send
---

- **ID**: `internal.terminator.response`
- **Source**: `src/plugins/l7/response/mod.rs`
- **Trait**: `L7Terminator`
- **Layer**: **L7 Only** (Final Phase)

## Logic Flow

This plugin acts as the **Second Phase** (The Terminator) of Vane's L7 Two-Phase Dispatch. It takes the state of the `Container` (which may have been populated by [Upstream](../middleware/upstream) or [Static](../middleware/static-files)) and flushes it to the client.

<Mermaid
	chart="
graph LR
    Input[Container State] --> WebSocket{Upgrade?}
    WebSocket -- Yes --> Tunnel[Bi-directional Tunnel]
    WebSocket -- No --> Headers[Finalize Headers]
    Headers --> Body[Prepare Body Stream]
    Body --> Send[Flush to Client]
    Send --> Finish([Close Request])
"
/>

### Parameters

| Name      | Required | Description                                                   |
| :-------- | :------- | :------------------------------------------------------------ |
| `status`  | No       | HTTP Status Code (default 200, or inherit from Container).    |
| `headers` | No       | Map of response headers (merges/overrides Container headers). |
| `body`    | No       | Response body content (overrides Container body).             |

### Advanced Body Configuration

The `body` parameter supports raw strings or a structured object for binary data:

```json
// Raw String
"body": "Hello World"

// Structured (Base64)
"body": {
    "content": "SGVsbG8gV29ybGQ=",
    "encoding": "base64" // Options: "text", "base64", "hex"
}
```