Skip to content

Commit ed0c26c

Browse files
authored
feat(openapi-fetch): enable middleware request param module augmentation (#2527)
1 parent 5ca8369 commit ed0c26c

1 file changed

Lines changed: 8 additions & 6 deletions

File tree

packages/openapi-fetch/src/index.d.ts

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -132,18 +132,20 @@ export type MergedOptions<T = unknown> = {
132132
fetch: typeof globalThis.fetch;
133133
};
134134

135+
export interface MiddlewareRequestParams {
136+
query?: Record<string, unknown>;
137+
header?: Record<string, unknown>;
138+
path?: Record<string, unknown>;
139+
cookie?: Record<string, unknown>;
140+
}
141+
135142
export interface MiddlewareCallbackParams {
136143
/** Current Request object */
137144
request: Request;
138145
/** The original OpenAPI schema path (including curly braces) */
139146
readonly schemaPath: string;
140147
/** OpenAPI parameters as provided from openapi-fetch */
141-
readonly params: {
142-
query?: Record<string, unknown>;
143-
header?: Record<string, unknown>;
144-
path?: Record<string, unknown>;
145-
cookie?: Record<string, unknown>;
146-
};
148+
readonly params: MiddlewareRequestParams;
147149
/** Unique ID for this request */
148150
readonly id: string;
149151
/** createClient options (read-only) */

0 commit comments

Comments
 (0)