oRPC Building Custom Plugins
Installation
SKILL.md
Building Custom Plugins
This guide explains how to create custom oRPC plugins for handlers and links.
What is a Plugin?
In oRPC, a plugin is a collection of interceptors that can work together or independently.
export class ResponseHeadersPlugin<T extends ResponseHeadersPluginContext> implements StandardHandlerPlugin<T> {
init(options: StandardHandlerOptions<T>): void {
options.rootInterceptors ??= []
options.rootInterceptors.push(async (interceptorOptions) => {
const resHeaders = interceptorOptions.context.resHeaders ?? new Headers()