From c96263ecc70bae2a1b1833df6bd535f35efc3671 Mon Sep 17 00:00:00 2001 From: Vinay Raghu Date: Wed, 25 Feb 2026 13:28:46 -0500 Subject: [PATCH] fix: convert Headers to plain object before request validation --- .../src/plugins/@hey-api/client-angular/bundle/client.ts | 5 ++++- .../src/plugins/@hey-api/client-fetch/bundle/client.ts | 5 ++++- .../src/plugins/@hey-api/client-ky/bundle/client.ts | 5 ++++- .../src/plugins/@hey-api/client-next/bundle/client.ts | 5 ++++- .../src/plugins/@hey-api/client-nuxt/bundle/client.ts | 5 ++++- .../src/plugins/@hey-api/client-ofetch/bundle/client.ts | 5 ++++- 6 files changed, 24 insertions(+), 6 deletions(-) diff --git a/packages/openapi-ts/src/plugins/@hey-api/client-angular/bundle/client.ts b/packages/openapi-ts/src/plugins/@hey-api/client-angular/bundle/client.ts index b74f3ecbd3..9672894075 100644 --- a/packages/openapi-ts/src/plugins/@hey-api/client-angular/bundle/client.ts +++ b/packages/openapi-ts/src/plugins/@hey-api/client-angular/bundle/client.ts @@ -106,7 +106,10 @@ export const createClient = (config: Config = {}): Client => { } if (opts.requestValidator) { - await opts.requestValidator(opts); + await opts.requestValidator({ + ...opts, + headers: Object.fromEntries(opts.headers.entries()), + }); } return { opts, req, url }; diff --git a/packages/openapi-ts/src/plugins/@hey-api/client-fetch/bundle/client.ts b/packages/openapi-ts/src/plugins/@hey-api/client-fetch/bundle/client.ts index bace63aa07..39ed22ec34 100644 --- a/packages/openapi-ts/src/plugins/@hey-api/client-fetch/bundle/client.ts +++ b/packages/openapi-ts/src/plugins/@hey-api/client-fetch/bundle/client.ts @@ -46,7 +46,10 @@ export const createClient = (config: Config = {}): Client => { } if (opts.requestValidator) { - await opts.requestValidator(opts); + await opts.requestValidator({ + ...opts, + headers: Object.fromEntries(opts.headers.entries()), + }); } if (opts.body !== undefined && opts.bodySerializer) { diff --git a/packages/openapi-ts/src/plugins/@hey-api/client-ky/bundle/client.ts b/packages/openapi-ts/src/plugins/@hey-api/client-ky/bundle/client.ts index 9f280d2aaa..d1c383722a 100644 --- a/packages/openapi-ts/src/plugins/@hey-api/client-ky/bundle/client.ts +++ b/packages/openapi-ts/src/plugins/@hey-api/client-ky/bundle/client.ts @@ -45,7 +45,10 @@ export const createClient = (config: Config = {}): Client => { } if (opts.requestValidator) { - await opts.requestValidator(opts); + await opts.requestValidator({ + ...opts, + headers: Object.fromEntries(opts.headers.entries()), + }); } if (opts.body !== undefined && opts.bodySerializer) { diff --git a/packages/openapi-ts/src/plugins/@hey-api/client-next/bundle/client.ts b/packages/openapi-ts/src/plugins/@hey-api/client-next/bundle/client.ts index 4e76ab03de..2af534c795 100644 --- a/packages/openapi-ts/src/plugins/@hey-api/client-next/bundle/client.ts +++ b/packages/openapi-ts/src/plugins/@hey-api/client-next/bundle/client.ts @@ -46,7 +46,10 @@ export const createClient = (config: Config = {}): Client => { } if (opts.requestValidator) { - await opts.requestValidator(opts); + await opts.requestValidator({ + ...opts, + headers: Object.fromEntries(opts.headers.entries()), + }); } if (opts.body !== undefined && opts.bodySerializer) { diff --git a/packages/openapi-ts/src/plugins/@hey-api/client-nuxt/bundle/client.ts b/packages/openapi-ts/src/plugins/@hey-api/client-nuxt/bundle/client.ts index 44e34f2888..8179128c17 100644 --- a/packages/openapi-ts/src/plugins/@hey-api/client-nuxt/bundle/client.ts +++ b/packages/openapi-ts/src/plugins/@hey-api/client-nuxt/bundle/client.ts @@ -45,7 +45,10 @@ export const createClient = (config: Config = {}): Client => { } if (opts.requestValidator) { - await opts.requestValidator(opts); + await opts.requestValidator({ + ...opts, + headers: Object.fromEntries(opts.headers.entries()), + }); } const url = buildUrl(opts); diff --git a/packages/openapi-ts/src/plugins/@hey-api/client-ofetch/bundle/client.ts b/packages/openapi-ts/src/plugins/@hey-api/client-ofetch/bundle/client.ts index 5f4e2e3270..ac6bece17e 100644 --- a/packages/openapi-ts/src/plugins/@hey-api/client-ofetch/bundle/client.ts +++ b/packages/openapi-ts/src/plugins/@hey-api/client-ofetch/bundle/client.ts @@ -54,7 +54,10 @@ export const createClient = (config: Config = {}): Client => { } if (opts.requestValidator) { - await opts.requestValidator(opts); + await opts.requestValidator({ + ...opts, + headers: Object.fromEntries(opts.headers.entries()), + }); } if (opts.body !== undefined && opts.bodySerializer) {