Middleware is the surface exposed by each concrete implementation. The Manager invokes it through the Dispatcher, passing a cloned Input. Each middleware lives in exactly one Slot. Close releases any resources owned by the middleware instance (background goroutines, file handles). It is invoked whe
| 12 | // must be idempotent and safe to call after construction even when |
| 13 | // Invoke was never called. |
| 14 | type Middleware interface { |
| 15 | ID() string |
| 16 | Version() string |
| 17 | Slot() Slot |
| 18 | |
| 19 | // AcceptedContentTypes lists the request/response content types |
| 20 | // the middleware needs the body for. Empty slice means the |
| 21 | // middleware does not inspect the body. |
| 22 | AcceptedContentTypes() []string |
| 23 | |
| 24 | // MetadataKeys is the closed set of metadata keys this middleware |
| 25 | // may emit. The accumulator drops anything outside this allowlist. |
| 26 | MetadataKeys() []string |
| 27 | |
| 28 | // MutationsSupported reports whether the middleware may emit |
| 29 | // header / body mutations. A spec with CanMutate=true is honoured |
| 30 | // only when the implementation also supports mutations. |
| 31 | MutationsSupported() bool |
| 32 | |
| 33 | Invoke(ctx context.Context, in *Input) (*Output, error) |
| 34 | |
| 35 | Close() error |
| 36 | } |
| 37 | |
| 38 | // Factory builds a configured Middleware instance from raw config |
| 39 | // bytes shipped on the wire. Each registered middleware ID has a |
no outgoing calls
no test coverage detected