Skip to content

Commit 0d11a46

Browse files
feat: add headers to plugin context type (#232)
Signed-off-by: Dylan Kilkenny <dylankilkenny95@gmail.com>
1 parent 8cdc456 commit 0d11a46

2 files changed

Lines changed: 14 additions & 1 deletion

File tree

custom-models/plugin-api.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -184,12 +184,19 @@ export interface PluginKVStore {
184184
): Promise<T | null>;
185185
}
186186

187+
/**
188+
* HTTP headers from the incoming request.
189+
* Each header name maps to an array of values (since HTTP headers can have multiple values).
190+
*/
191+
export type PluginHeaders = Record<string, string[]>;
192+
187193
/**
188194
* Plugin context with KV always available for modern plugins.
189195
*/
190196
export interface PluginContext {
191197
api: PluginAPI;
192198
kv: PluginKVStore;
199+
headers: PluginHeaders;
193200
params: any;
194201
}
195202

src/models/plugin-api.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -184,13 +184,19 @@ export interface PluginKVStore {
184184
): Promise<T | null>;
185185
}
186186

187+
/**
188+
* HTTP headers from the incoming request.
189+
* Each header name maps to an array of values (since HTTP headers can have multiple values).
190+
*/
191+
export type PluginHeaders = Record<string, string[]>;
192+
187193
/**
188194
* Plugin context with KV always available for modern plugins.
189195
*/
190196
export interface PluginContext {
191197
api: PluginAPI;
192198
kv: PluginKVStore;
193-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
199+
headers: PluginHeaders;
194200
params: any;
195201
}
196202

0 commit comments

Comments
 (0)