diff --git a/examples/openapi-ts-axios/src/client/client/client.gen.ts b/examples/openapi-ts-axios/src/client/client/client.gen.ts index b2f7b118f..f0454c2ef 100644 --- a/examples/openapi-ts-axios/src/client/client/client.gen.ts +++ b/examples/openapi-ts-axios/src/client/client/client.gen.ts @@ -54,14 +54,14 @@ export const createClient = (config: Config = {}): Client => { }); } - if (opts.requestValidator) { - await opts.requestValidator(opts); - } - if (opts.body && opts.bodySerializer) { opts.body = opts.bodySerializer(opts.body); } + if (opts.requestValidator) { + await opts.requestValidator(opts); + } + const url = buildUrl(opts); try { diff --git a/examples/openapi-ts-fetch/src/client/client/client.ts b/examples/openapi-ts-fetch/src/client/client/client.ts index dddfe80c0..1c8df4534 100644 --- a/examples/openapi-ts-fetch/src/client/client/client.ts +++ b/examples/openapi-ts-fetch/src/client/client/client.ts @@ -46,14 +46,14 @@ export const createClient = (config: Config = {}): Client => { }); } - if (opts.requestValidator) { - await opts.requestValidator(opts); - } - if (opts.body && opts.bodySerializer) { opts.body = opts.bodySerializer(opts.body); } + if (opts.requestValidator) { + await opts.requestValidator(opts); + } + // remove Content-Type header if body is empty to avoid sending invalid requests if (opts.body === undefined || opts.body === '') { opts.headers.delete('Content-Type'); diff --git a/examples/openapi-ts-openai/src/client/client/client.gen.ts b/examples/openapi-ts-openai/src/client/client/client.gen.ts index 0c606b81c..3ab319438 100644 --- a/examples/openapi-ts-openai/src/client/client/client.gen.ts +++ b/examples/openapi-ts-openai/src/client/client/client.gen.ts @@ -49,14 +49,14 @@ export const createClient = (config: Config = {}): Client => { }); } - if (opts.requestValidator) { - await opts.requestValidator(opts); - } - if (opts.body && opts.bodySerializer) { opts.serializedBody = opts.bodySerializer(opts.body); } + if (opts.requestValidator) { + await opts.requestValidator(opts); + } + // remove Content-Type header if body is empty to avoid sending invalid requests if (opts.serializedBody === undefined || opts.serializedBody === '') { opts.headers.delete('Content-Type'); diff --git a/examples/openapi-ts-sample/src/client/client/client.ts b/examples/openapi-ts-sample/src/client/client/client.ts index 89d1e3158..5ea8cb1f6 100644 --- a/examples/openapi-ts-sample/src/client/client/client.ts +++ b/examples/openapi-ts-sample/src/client/client/client.ts @@ -46,14 +46,14 @@ export const createClient = (config: Config = {}): Client => { }); } - if (opts.requestValidator) { - await opts.requestValidator(opts); - } - if (opts.body && opts.bodySerializer) { opts.body = opts.bodySerializer(opts.body); } + if (opts.requestValidator) { + await opts.requestValidator(opts); + } + // remove Content-Type header if body is empty to avoid sending invalid requests if (opts.body === undefined || opts.body === '') { opts.headers.delete('Content-Type'); diff --git a/examples/openapi-ts-tanstack-angular-query-experimental/src/client/client/client.gen.ts b/examples/openapi-ts-tanstack-angular-query-experimental/src/client/client/client.gen.ts index 3fd4a2427..4fb9ad862 100644 --- a/examples/openapi-ts-tanstack-angular-query-experimental/src/client/client/client.gen.ts +++ b/examples/openapi-ts-tanstack-angular-query-experimental/src/client/client/client.gen.ts @@ -77,14 +77,14 @@ export const createClient = (config: Config = {}): Client => { }); } - if (opts.requestValidator) { - await opts.requestValidator(opts); - } - if (opts.body && opts.bodySerializer) { opts.serializedBody = opts.bodySerializer(opts.body); } + if (opts.requestValidator) { + await opts.requestValidator(opts); + } + // remove Content-Type header if body is empty to avoid sending invalid requests if (opts.serializedBody === undefined || opts.serializedBody === '') { opts.headers.delete('Content-Type'); diff --git a/packages/custom-client/src/client.ts b/packages/custom-client/src/client.ts index 491eab1f6..400b5cfa8 100644 --- a/packages/custom-client/src/client.ts +++ b/packages/custom-client/src/client.ts @@ -47,14 +47,14 @@ export const createClient = (config: Config = {}): Client => { }); } - if (opts.requestValidator) { - await opts.requestValidator(opts); - } - if (opts.body && opts.bodySerializer) { opts.body = opts.bodySerializer(opts.body); } + if (opts.requestValidator) { + await opts.requestValidator(opts); + } + // remove Content-Type header if body is empty to avoid sending invalid requests if (opts.body === undefined || opts.body === '') { opts.headers.delete('Content-Type'); diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/body-response-text-plain/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/body-response-text-plain/client/client.gen.ts index f68339318..711020aa6 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/body-response-text-plain/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/body-response-text-plain/client/client.gen.ts @@ -56,14 +56,14 @@ export const createClient = (config: Config = {}): Client => { }); } - if (opts.requestValidator) { - await opts.requestValidator(opts); - } - if (opts.body && opts.bodySerializer) { opts.serializedBody = opts.bodySerializer(opts.body); } + if (opts.requestValidator) { + await opts.requestValidator(opts); + } + // remove Content-Type header if body is empty to avoid sending invalid requests if (opts.serializedBody === undefined || opts.serializedBody === '') { opts.headers.delete('Content-Type'); diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/form-data/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/form-data/client/client.gen.ts index f68339318..711020aa6 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/form-data/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/form-data/client/client.gen.ts @@ -56,14 +56,14 @@ export const createClient = (config: Config = {}): Client => { }); } - if (opts.requestValidator) { - await opts.requestValidator(opts); - } - if (opts.body && opts.bodySerializer) { opts.serializedBody = opts.bodySerializer(opts.body); } + if (opts.requestValidator) { + await opts.requestValidator(opts); + } + // remove Content-Type header if body is empty to avoid sending invalid requests if (opts.serializedBody === undefined || opts.serializedBody === '') { opts.headers.delete('Content-Type'); diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@hey-api/client-fetch/sdk-nested-classes-instance/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@hey-api/client-fetch/sdk-nested-classes-instance/client/client.gen.ts index f68339318..711020aa6 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@hey-api/client-fetch/sdk-nested-classes-instance/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@hey-api/client-fetch/sdk-nested-classes-instance/client/client.gen.ts @@ -56,14 +56,14 @@ export const createClient = (config: Config = {}): Client => { }); } - if (opts.requestValidator) { - await opts.requestValidator(opts); - } - if (opts.body && opts.bodySerializer) { opts.serializedBody = opts.bodySerializer(opts.body); } + if (opts.requestValidator) { + await opts.requestValidator(opts); + } + // remove Content-Type header if body is empty to avoid sending invalid requests if (opts.serializedBody === undefined || opts.serializedBody === '') { opts.headers.delete('Content-Type'); diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@hey-api/client-fetch/sdk-nested-classes/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@hey-api/client-fetch/sdk-nested-classes/client/client.gen.ts index f68339318..711020aa6 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@hey-api/client-fetch/sdk-nested-classes/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@hey-api/client-fetch/sdk-nested-classes/client/client.gen.ts @@ -56,14 +56,14 @@ export const createClient = (config: Config = {}): Client => { }); } - if (opts.requestValidator) { - await opts.requestValidator(opts); - } - if (opts.body && opts.bodySerializer) { opts.serializedBody = opts.bodySerializer(opts.body); } + if (opts.requestValidator) { + await opts.requestValidator(opts); + } + // remove Content-Type header if body is empty to avoid sending invalid requests if (opts.serializedBody === undefined || opts.serializedBody === '') { opts.headers.delete('Content-Type'); diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@hey-api/sdk/default/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@hey-api/sdk/default/client/client.gen.ts index f68339318..711020aa6 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@hey-api/sdk/default/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@hey-api/sdk/default/client/client.gen.ts @@ -56,14 +56,14 @@ export const createClient = (config: Config = {}): Client => { }); } - if (opts.requestValidator) { - await opts.requestValidator(opts); - } - if (opts.body && opts.bodySerializer) { opts.serializedBody = opts.bodySerializer(opts.body); } + if (opts.requestValidator) { + await opts.requestValidator(opts); + } + // remove Content-Type header if body is empty to avoid sending invalid requests if (opts.serializedBody === undefined || opts.serializedBody === '') { opts.headers.delete('Content-Type'); diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@hey-api/sdk/instance/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@hey-api/sdk/instance/client/client.gen.ts index f68339318..711020aa6 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@hey-api/sdk/instance/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@hey-api/sdk/instance/client/client.gen.ts @@ -56,14 +56,14 @@ export const createClient = (config: Config = {}): Client => { }); } - if (opts.requestValidator) { - await opts.requestValidator(opts); - } - if (opts.body && opts.bodySerializer) { opts.serializedBody = opts.bodySerializer(opts.body); } + if (opts.requestValidator) { + await opts.requestValidator(opts); + } + // remove Content-Type header if body is empty to avoid sending invalid requests if (opts.serializedBody === undefined || opts.serializedBody === '') { opts.headers.delete('Content-Type'); diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@hey-api/sdk/throwOnError/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@hey-api/sdk/throwOnError/client/client.gen.ts index f68339318..711020aa6 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@hey-api/sdk/throwOnError/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@hey-api/sdk/throwOnError/client/client.gen.ts @@ -56,14 +56,14 @@ export const createClient = (config: Config = {}): Client => { }); } - if (opts.requestValidator) { - await opts.requestValidator(opts); - } - if (opts.body && opts.bodySerializer) { opts.serializedBody = opts.bodySerializer(opts.body); } + if (opts.requestValidator) { + await opts.requestValidator(opts); + } + // remove Content-Type header if body is empty to avoid sending invalid requests if (opts.serializedBody === undefined || opts.serializedBody === '') { opts.headers.delete('Content-Type'); diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@hey-api/transformers/type-format-valibot/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@hey-api/transformers/type-format-valibot/client/client.gen.ts index f68339318..711020aa6 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@hey-api/transformers/type-format-valibot/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@hey-api/transformers/type-format-valibot/client/client.gen.ts @@ -56,14 +56,14 @@ export const createClient = (config: Config = {}): Client => { }); } - if (opts.requestValidator) { - await opts.requestValidator(opts); - } - if (opts.body && opts.bodySerializer) { opts.serializedBody = opts.bodySerializer(opts.body); } + if (opts.requestValidator) { + await opts.requestValidator(opts); + } + // remove Content-Type header if body is empty to avoid sending invalid requests if (opts.serializedBody === undefined || opts.serializedBody === '') { opts.headers.delete('Content-Type'); diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@hey-api/transformers/type-format-zod/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@hey-api/transformers/type-format-zod/client/client.gen.ts index f68339318..711020aa6 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@hey-api/transformers/type-format-zod/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@hey-api/transformers/type-format-zod/client/client.gen.ts @@ -56,14 +56,14 @@ export const createClient = (config: Config = {}): Client => { }); } - if (opts.requestValidator) { - await opts.requestValidator(opts); - } - if (opts.body && opts.bodySerializer) { opts.serializedBody = opts.bodySerializer(opts.body); } + if (opts.requestValidator) { + await opts.requestValidator(opts); + } + // remove Content-Type header if body is empty to avoid sending invalid requests if (opts.serializedBody === undefined || opts.serializedBody === '') { opts.headers.delete('Content-Type'); diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@hey-api/typescript/transforms-read-write-custom-name/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@hey-api/typescript/transforms-read-write-custom-name/client/client.gen.ts index f68339318..711020aa6 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@hey-api/typescript/transforms-read-write-custom-name/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@hey-api/typescript/transforms-read-write-custom-name/client/client.gen.ts @@ -56,14 +56,14 @@ export const createClient = (config: Config = {}): Client => { }); } - if (opts.requestValidator) { - await opts.requestValidator(opts); - } - if (opts.body && opts.bodySerializer) { opts.serializedBody = opts.bodySerializer(opts.body); } + if (opts.requestValidator) { + await opts.requestValidator(opts); + } + // remove Content-Type header if body is empty to avoid sending invalid requests if (opts.serializedBody === undefined || opts.serializedBody === '') { opts.headers.delete('Content-Type'); diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@hey-api/typescript/transforms-read-write-ignore/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@hey-api/typescript/transforms-read-write-ignore/client/client.gen.ts index f68339318..711020aa6 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@hey-api/typescript/transforms-read-write-ignore/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@hey-api/typescript/transforms-read-write-ignore/client/client.gen.ts @@ -56,14 +56,14 @@ export const createClient = (config: Config = {}): Client => { }); } - if (opts.requestValidator) { - await opts.requestValidator(opts); - } - if (opts.body && opts.bodySerializer) { opts.serializedBody = opts.bodySerializer(opts.body); } + if (opts.requestValidator) { + await opts.requestValidator(opts); + } + // remove Content-Type header if body is empty to avoid sending invalid requests if (opts.serializedBody === undefined || opts.serializedBody === '') { opts.headers.delete('Content-Type'); diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@pinia/colada/fetch/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@pinia/colada/fetch/client/client.gen.ts index f68339318..711020aa6 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@pinia/colada/fetch/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@pinia/colada/fetch/client/client.gen.ts @@ -56,14 +56,14 @@ export const createClient = (config: Config = {}): Client => { }); } - if (opts.requestValidator) { - await opts.requestValidator(opts); - } - if (opts.body && opts.bodySerializer) { opts.serializedBody = opts.bodySerializer(opts.body); } + if (opts.requestValidator) { + await opts.requestValidator(opts); + } + // remove Content-Type header if body is empty to avoid sending invalid requests if (opts.serializedBody === undefined || opts.serializedBody === '') { opts.headers.delete('Content-Type'); diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@pinia/colada/group-by-tag/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@pinia/colada/group-by-tag/client/client.gen.ts index f68339318..711020aa6 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@pinia/colada/group-by-tag/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@pinia/colada/group-by-tag/client/client.gen.ts @@ -56,14 +56,14 @@ export const createClient = (config: Config = {}): Client => { }); } - if (opts.requestValidator) { - await opts.requestValidator(opts); - } - if (opts.body && opts.bodySerializer) { opts.serializedBody = opts.bodySerializer(opts.body); } + if (opts.requestValidator) { + await opts.requestValidator(opts); + } + // remove Content-Type header if body is empty to avoid sending invalid requests if (opts.serializedBody === undefined || opts.serializedBody === '') { opts.headers.delete('Content-Type'); diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/angular-query-experimental/asClass/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/angular-query-experimental/asClass/client/client.gen.ts index f68339318..711020aa6 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/angular-query-experimental/asClass/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/angular-query-experimental/asClass/client/client.gen.ts @@ -56,14 +56,14 @@ export const createClient = (config: Config = {}): Client => { }); } - if (opts.requestValidator) { - await opts.requestValidator(opts); - } - if (opts.body && opts.bodySerializer) { opts.serializedBody = opts.bodySerializer(opts.body); } + if (opts.requestValidator) { + await opts.requestValidator(opts); + } + // remove Content-Type header if body is empty to avoid sending invalid requests if (opts.serializedBody === undefined || opts.serializedBody === '') { opts.headers.delete('Content-Type'); diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/angular-query-experimental/axios/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/angular-query-experimental/axios/client/client.gen.ts index 06ff1ec77..e3e634266 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/angular-query-experimental/axios/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/angular-query-experimental/axios/client/client.gen.ts @@ -55,14 +55,14 @@ export const createClient = (config: Config = {}): Client => { }); } - if (opts.requestValidator) { - await opts.requestValidator(opts); - } - if (opts.body && opts.bodySerializer) { opts.body = opts.bodySerializer(opts.body); } + if (opts.requestValidator) { + await opts.requestValidator(opts); + } + const url = buildUrl(opts); return { opts, url }; diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/angular-query-experimental/fetch/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/angular-query-experimental/fetch/client/client.gen.ts index f68339318..711020aa6 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/angular-query-experimental/fetch/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/angular-query-experimental/fetch/client/client.gen.ts @@ -56,14 +56,14 @@ export const createClient = (config: Config = {}): Client => { }); } - if (opts.requestValidator) { - await opts.requestValidator(opts); - } - if (opts.body && opts.bodySerializer) { opts.serializedBody = opts.bodySerializer(opts.body); } + if (opts.requestValidator) { + await opts.requestValidator(opts); + } + // remove Content-Type header if body is empty to avoid sending invalid requests if (opts.serializedBody === undefined || opts.serializedBody === '') { opts.headers.delete('Content-Type'); diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/angular-query-experimental/name-builder/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/angular-query-experimental/name-builder/client/client.gen.ts index f68339318..711020aa6 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/angular-query-experimental/name-builder/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/angular-query-experimental/name-builder/client/client.gen.ts @@ -56,14 +56,14 @@ export const createClient = (config: Config = {}): Client => { }); } - if (opts.requestValidator) { - await opts.requestValidator(opts); - } - if (opts.body && opts.bodySerializer) { opts.serializedBody = opts.bodySerializer(opts.body); } + if (opts.requestValidator) { + await opts.requestValidator(opts); + } + // remove Content-Type header if body is empty to avoid sending invalid requests if (opts.serializedBody === undefined || opts.serializedBody === '') { opts.headers.delete('Content-Type'); diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/react-query/asClass/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/react-query/asClass/client/client.gen.ts index f68339318..711020aa6 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/react-query/asClass/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/react-query/asClass/client/client.gen.ts @@ -56,14 +56,14 @@ export const createClient = (config: Config = {}): Client => { }); } - if (opts.requestValidator) { - await opts.requestValidator(opts); - } - if (opts.body && opts.bodySerializer) { opts.serializedBody = opts.bodySerializer(opts.body); } + if (opts.requestValidator) { + await opts.requestValidator(opts); + } + // remove Content-Type header if body is empty to avoid sending invalid requests if (opts.serializedBody === undefined || opts.serializedBody === '') { opts.headers.delete('Content-Type'); diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/react-query/axios/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/react-query/axios/client/client.gen.ts index 06ff1ec77..e3e634266 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/react-query/axios/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/react-query/axios/client/client.gen.ts @@ -55,14 +55,14 @@ export const createClient = (config: Config = {}): Client => { }); } - if (opts.requestValidator) { - await opts.requestValidator(opts); - } - if (opts.body && opts.bodySerializer) { opts.body = opts.bodySerializer(opts.body); } + if (opts.requestValidator) { + await opts.requestValidator(opts); + } + const url = buildUrl(opts); return { opts, url }; diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/react-query/fetch/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/react-query/fetch/client/client.gen.ts index f68339318..711020aa6 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/react-query/fetch/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/react-query/fetch/client/client.gen.ts @@ -56,14 +56,14 @@ export const createClient = (config: Config = {}): Client => { }); } - if (opts.requestValidator) { - await opts.requestValidator(opts); - } - if (opts.body && opts.bodySerializer) { opts.serializedBody = opts.bodySerializer(opts.body); } + if (opts.requestValidator) { + await opts.requestValidator(opts); + } + // remove Content-Type header if body is empty to avoid sending invalid requests if (opts.serializedBody === undefined || opts.serializedBody === '') { opts.headers.delete('Content-Type'); diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/react-query/name-builder/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/react-query/name-builder/client/client.gen.ts index f68339318..711020aa6 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/react-query/name-builder/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/react-query/name-builder/client/client.gen.ts @@ -56,14 +56,14 @@ export const createClient = (config: Config = {}): Client => { }); } - if (opts.requestValidator) { - await opts.requestValidator(opts); - } - if (opts.body && opts.bodySerializer) { opts.serializedBody = opts.bodySerializer(opts.body); } + if (opts.requestValidator) { + await opts.requestValidator(opts); + } + // remove Content-Type header if body is empty to avoid sending invalid requests if (opts.serializedBody === undefined || opts.serializedBody === '') { opts.headers.delete('Content-Type'); diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/solid-query/asClass/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/solid-query/asClass/client/client.gen.ts index f68339318..711020aa6 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/solid-query/asClass/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/solid-query/asClass/client/client.gen.ts @@ -56,14 +56,14 @@ export const createClient = (config: Config = {}): Client => { }); } - if (opts.requestValidator) { - await opts.requestValidator(opts); - } - if (opts.body && opts.bodySerializer) { opts.serializedBody = opts.bodySerializer(opts.body); } + if (opts.requestValidator) { + await opts.requestValidator(opts); + } + // remove Content-Type header if body is empty to avoid sending invalid requests if (opts.serializedBody === undefined || opts.serializedBody === '') { opts.headers.delete('Content-Type'); diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/solid-query/axios/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/solid-query/axios/client/client.gen.ts index 06ff1ec77..e3e634266 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/solid-query/axios/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/solid-query/axios/client/client.gen.ts @@ -55,14 +55,14 @@ export const createClient = (config: Config = {}): Client => { }); } - if (opts.requestValidator) { - await opts.requestValidator(opts); - } - if (opts.body && opts.bodySerializer) { opts.body = opts.bodySerializer(opts.body); } + if (opts.requestValidator) { + await opts.requestValidator(opts); + } + const url = buildUrl(opts); return { opts, url }; diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/solid-query/fetch/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/solid-query/fetch/client/client.gen.ts index f68339318..711020aa6 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/solid-query/fetch/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/solid-query/fetch/client/client.gen.ts @@ -56,14 +56,14 @@ export const createClient = (config: Config = {}): Client => { }); } - if (opts.requestValidator) { - await opts.requestValidator(opts); - } - if (opts.body && opts.bodySerializer) { opts.serializedBody = opts.bodySerializer(opts.body); } + if (opts.requestValidator) { + await opts.requestValidator(opts); + } + // remove Content-Type header if body is empty to avoid sending invalid requests if (opts.serializedBody === undefined || opts.serializedBody === '') { opts.headers.delete('Content-Type'); diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/solid-query/name-builder/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/solid-query/name-builder/client/client.gen.ts index f68339318..711020aa6 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/solid-query/name-builder/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/solid-query/name-builder/client/client.gen.ts @@ -56,14 +56,14 @@ export const createClient = (config: Config = {}): Client => { }); } - if (opts.requestValidator) { - await opts.requestValidator(opts); - } - if (opts.body && opts.bodySerializer) { opts.serializedBody = opts.bodySerializer(opts.body); } + if (opts.requestValidator) { + await opts.requestValidator(opts); + } + // remove Content-Type header if body is empty to avoid sending invalid requests if (opts.serializedBody === undefined || opts.serializedBody === '') { opts.headers.delete('Content-Type'); diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/svelte-query/asClass/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/svelte-query/asClass/client/client.gen.ts index f68339318..711020aa6 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/svelte-query/asClass/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/svelte-query/asClass/client/client.gen.ts @@ -56,14 +56,14 @@ export const createClient = (config: Config = {}): Client => { }); } - if (opts.requestValidator) { - await opts.requestValidator(opts); - } - if (opts.body && opts.bodySerializer) { opts.serializedBody = opts.bodySerializer(opts.body); } + if (opts.requestValidator) { + await opts.requestValidator(opts); + } + // remove Content-Type header if body is empty to avoid sending invalid requests if (opts.serializedBody === undefined || opts.serializedBody === '') { opts.headers.delete('Content-Type'); diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/svelte-query/axios/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/svelte-query/axios/client/client.gen.ts index 06ff1ec77..e3e634266 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/svelte-query/axios/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/svelte-query/axios/client/client.gen.ts @@ -55,14 +55,14 @@ export const createClient = (config: Config = {}): Client => { }); } - if (opts.requestValidator) { - await opts.requestValidator(opts); - } - if (opts.body && opts.bodySerializer) { opts.body = opts.bodySerializer(opts.body); } + if (opts.requestValidator) { + await opts.requestValidator(opts); + } + const url = buildUrl(opts); return { opts, url }; diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/svelte-query/fetch/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/svelte-query/fetch/client/client.gen.ts index f68339318..711020aa6 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/svelte-query/fetch/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/svelte-query/fetch/client/client.gen.ts @@ -56,14 +56,14 @@ export const createClient = (config: Config = {}): Client => { }); } - if (opts.requestValidator) { - await opts.requestValidator(opts); - } - if (opts.body && opts.bodySerializer) { opts.serializedBody = opts.bodySerializer(opts.body); } + if (opts.requestValidator) { + await opts.requestValidator(opts); + } + // remove Content-Type header if body is empty to avoid sending invalid requests if (opts.serializedBody === undefined || opts.serializedBody === '') { opts.headers.delete('Content-Type'); diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/svelte-query/name-builder/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/svelte-query/name-builder/client/client.gen.ts index f68339318..711020aa6 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/svelte-query/name-builder/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/svelte-query/name-builder/client/client.gen.ts @@ -56,14 +56,14 @@ export const createClient = (config: Config = {}): Client => { }); } - if (opts.requestValidator) { - await opts.requestValidator(opts); - } - if (opts.body && opts.bodySerializer) { opts.serializedBody = opts.bodySerializer(opts.body); } + if (opts.requestValidator) { + await opts.requestValidator(opts); + } + // remove Content-Type header if body is empty to avoid sending invalid requests if (opts.serializedBody === undefined || opts.serializedBody === '') { opts.headers.delete('Content-Type'); diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/vue-query/asClass/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/vue-query/asClass/client/client.gen.ts index f68339318..711020aa6 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/vue-query/asClass/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/vue-query/asClass/client/client.gen.ts @@ -56,14 +56,14 @@ export const createClient = (config: Config = {}): Client => { }); } - if (opts.requestValidator) { - await opts.requestValidator(opts); - } - if (opts.body && opts.bodySerializer) { opts.serializedBody = opts.bodySerializer(opts.body); } + if (opts.requestValidator) { + await opts.requestValidator(opts); + } + // remove Content-Type header if body is empty to avoid sending invalid requests if (opts.serializedBody === undefined || opts.serializedBody === '') { opts.headers.delete('Content-Type'); diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/vue-query/axios/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/vue-query/axios/client/client.gen.ts index 06ff1ec77..e3e634266 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/vue-query/axios/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/vue-query/axios/client/client.gen.ts @@ -55,14 +55,14 @@ export const createClient = (config: Config = {}): Client => { }); } - if (opts.requestValidator) { - await opts.requestValidator(opts); - } - if (opts.body && opts.bodySerializer) { opts.body = opts.bodySerializer(opts.body); } + if (opts.requestValidator) { + await opts.requestValidator(opts); + } + const url = buildUrl(opts); return { opts, url }; diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/vue-query/fetch/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/vue-query/fetch/client/client.gen.ts index f68339318..711020aa6 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/vue-query/fetch/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/vue-query/fetch/client/client.gen.ts @@ -56,14 +56,14 @@ export const createClient = (config: Config = {}): Client => { }); } - if (opts.requestValidator) { - await opts.requestValidator(opts); - } - if (opts.body && opts.bodySerializer) { opts.serializedBody = opts.bodySerializer(opts.body); } + if (opts.requestValidator) { + await opts.requestValidator(opts); + } + // remove Content-Type header if body is empty to avoid sending invalid requests if (opts.serializedBody === undefined || opts.serializedBody === '') { opts.headers.delete('Content-Type'); diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/vue-query/name-builder/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/vue-query/name-builder/client/client.gen.ts index f68339318..711020aa6 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/vue-query/name-builder/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/vue-query/name-builder/client/client.gen.ts @@ -56,14 +56,14 @@ export const createClient = (config: Config = {}): Client => { }); } - if (opts.requestValidator) { - await opts.requestValidator(opts); - } - if (opts.body && opts.bodySerializer) { opts.serializedBody = opts.bodySerializer(opts.body); } + if (opts.requestValidator) { + await opts.requestValidator(opts); + } + // remove Content-Type header if body is empty to avoid sending invalid requests if (opts.serializedBody === undefined || opts.serializedBody === '') { opts.headers.delete('Content-Type'); diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/schema-unknown/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/schema-unknown/client/client.gen.ts index f68339318..711020aa6 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/schema-unknown/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/schema-unknown/client/client.gen.ts @@ -56,14 +56,14 @@ export const createClient = (config: Config = {}): Client => { }); } - if (opts.requestValidator) { - await opts.requestValidator(opts); - } - if (opts.body && opts.bodySerializer) { opts.serializedBody = opts.bodySerializer(opts.body); } + if (opts.requestValidator) { + await opts.requestValidator(opts); + } + // remove Content-Type header if body is empty to avoid sending invalid requests if (opts.serializedBody === undefined || opts.serializedBody === '') { opts.headers.delete('Content-Type'); diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/security-api-key/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/security-api-key/client/client.gen.ts index f68339318..711020aa6 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/security-api-key/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/security-api-key/client/client.gen.ts @@ -56,14 +56,14 @@ export const createClient = (config: Config = {}): Client => { }); } - if (opts.requestValidator) { - await opts.requestValidator(opts); - } - if (opts.body && opts.bodySerializer) { opts.serializedBody = opts.bodySerializer(opts.body); } + if (opts.requestValidator) { + await opts.requestValidator(opts); + } + // remove Content-Type header if body is empty to avoid sending invalid requests if (opts.serializedBody === undefined || opts.serializedBody === '') { opts.headers.delete('Content-Type'); diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/security-basic/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/security-basic/client/client.gen.ts index f68339318..711020aa6 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/security-basic/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/security-basic/client/client.gen.ts @@ -56,14 +56,14 @@ export const createClient = (config: Config = {}): Client => { }); } - if (opts.requestValidator) { - await opts.requestValidator(opts); - } - if (opts.body && opts.bodySerializer) { opts.serializedBody = opts.bodySerializer(opts.body); } + if (opts.requestValidator) { + await opts.requestValidator(opts); + } + // remove Content-Type header if body is empty to avoid sending invalid requests if (opts.serializedBody === undefined || opts.serializedBody === '') { opts.headers.delete('Content-Type'); diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/security-false/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/security-false/client/client.gen.ts index f68339318..711020aa6 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/security-false/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/security-false/client/client.gen.ts @@ -56,14 +56,14 @@ export const createClient = (config: Config = {}): Client => { }); } - if (opts.requestValidator) { - await opts.requestValidator(opts); - } - if (opts.body && opts.bodySerializer) { opts.serializedBody = opts.bodySerializer(opts.body); } + if (opts.requestValidator) { + await opts.requestValidator(opts); + } + // remove Content-Type header if body is empty to avoid sending invalid requests if (opts.serializedBody === undefined || opts.serializedBody === '') { opts.headers.delete('Content-Type'); diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/security-oauth2/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/security-oauth2/client/client.gen.ts index f68339318..711020aa6 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/security-oauth2/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/security-oauth2/client/client.gen.ts @@ -56,14 +56,14 @@ export const createClient = (config: Config = {}): Client => { }); } - if (opts.requestValidator) { - await opts.requestValidator(opts); - } - if (opts.body && opts.bodySerializer) { opts.serializedBody = opts.bodySerializer(opts.body); } + if (opts.requestValidator) { + await opts.requestValidator(opts); + } + // remove Content-Type header if body is empty to avoid sending invalid requests if (opts.serializedBody === undefined || opts.serializedBody === '') { opts.headers.delete('Content-Type'); diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/servers-base-path/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/servers-base-path/client/client.gen.ts index f68339318..711020aa6 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/servers-base-path/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/servers-base-path/client/client.gen.ts @@ -56,14 +56,14 @@ export const createClient = (config: Config = {}): Client => { }); } - if (opts.requestValidator) { - await opts.requestValidator(opts); - } - if (opts.body && opts.bodySerializer) { opts.serializedBody = opts.bodySerializer(opts.body); } + if (opts.requestValidator) { + await opts.requestValidator(opts); + } + // remove Content-Type header if body is empty to avoid sending invalid requests if (opts.serializedBody === undefined || opts.serializedBody === '') { opts.headers.delete('Content-Type'); diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/servers-host/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/servers-host/client/client.gen.ts index f68339318..711020aa6 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/servers-host/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/servers-host/client/client.gen.ts @@ -56,14 +56,14 @@ export const createClient = (config: Config = {}): Client => { }); } - if (opts.requestValidator) { - await opts.requestValidator(opts); - } - if (opts.body && opts.bodySerializer) { opts.serializedBody = opts.bodySerializer(opts.body); } + if (opts.requestValidator) { + await opts.requestValidator(opts); + } + // remove Content-Type header if body is empty to avoid sending invalid requests if (opts.serializedBody === undefined || opts.serializedBody === '') { opts.headers.delete('Content-Type'); diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/servers/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/servers/client/client.gen.ts index f68339318..711020aa6 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/servers/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/servers/client/client.gen.ts @@ -56,14 +56,14 @@ export const createClient = (config: Config = {}): Client => { }); } - if (opts.requestValidator) { - await opts.requestValidator(opts); - } - if (opts.body && opts.bodySerializer) { opts.serializedBody = opts.bodySerializer(opts.body); } + if (opts.requestValidator) { + await opts.requestValidator(opts); + } + // remove Content-Type header if body is empty to avoid sending invalid requests if (opts.serializedBody === undefined || opts.serializedBody === '') { opts.headers.delete('Content-Type'); diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/transforms-read-write/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/transforms-read-write/client/client.gen.ts index f68339318..711020aa6 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/transforms-read-write/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/transforms-read-write/client/client.gen.ts @@ -56,14 +56,14 @@ export const createClient = (config: Config = {}): Client => { }); } - if (opts.requestValidator) { - await opts.requestValidator(opts); - } - if (opts.body && opts.bodySerializer) { opts.serializedBody = opts.bodySerializer(opts.body); } + if (opts.requestValidator) { + await opts.requestValidator(opts); + } + // remove Content-Type header if body is empty to avoid sending invalid requests if (opts.serializedBody === undefined || opts.serializedBody === '') { opts.headers.delete('Content-Type'); diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/body-response-text-plain/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/body-response-text-plain/client/client.gen.ts index f68339318..711020aa6 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/body-response-text-plain/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/body-response-text-plain/client/client.gen.ts @@ -56,14 +56,14 @@ export const createClient = (config: Config = {}): Client => { }); } - if (opts.requestValidator) { - await opts.requestValidator(opts); - } - if (opts.body && opts.bodySerializer) { opts.serializedBody = opts.bodySerializer(opts.body); } + if (opts.requestValidator) { + await opts.requestValidator(opts); + } + // remove Content-Type header if body is empty to avoid sending invalid requests if (opts.serializedBody === undefined || opts.serializedBody === '') { opts.headers.delete('Content-Type'); diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/content-types/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/content-types/client/client.gen.ts index 06ff1ec77..e3e634266 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/content-types/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/content-types/client/client.gen.ts @@ -55,14 +55,14 @@ export const createClient = (config: Config = {}): Client => { }); } - if (opts.requestValidator) { - await opts.requestValidator(opts); - } - if (opts.body && opts.bodySerializer) { opts.body = opts.bodySerializer(opts.body); } + if (opts.requestValidator) { + await opts.requestValidator(opts); + } + const url = buildUrl(opts); return { opts, url }; diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/internal-name-conflict/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/internal-name-conflict/client/client.gen.ts index f68339318..711020aa6 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/internal-name-conflict/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/internal-name-conflict/client/client.gen.ts @@ -56,14 +56,14 @@ export const createClient = (config: Config = {}): Client => { }); } - if (opts.requestValidator) { - await opts.requestValidator(opts); - } - if (opts.body && opts.bodySerializer) { opts.serializedBody = opts.bodySerializer(opts.body); } + if (opts.requestValidator) { + await opts.requestValidator(opts); + } + // remove Content-Type header if body is empty to avoid sending invalid requests if (opts.serializedBody === undefined || opts.serializedBody === '') { opts.headers.delete('Content-Type'); diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/parameter-explode-false-axios/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/parameter-explode-false-axios/client/client.gen.ts index 06ff1ec77..e3e634266 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/parameter-explode-false-axios/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/parameter-explode-false-axios/client/client.gen.ts @@ -55,14 +55,14 @@ export const createClient = (config: Config = {}): Client => { }); } - if (opts.requestValidator) { - await opts.requestValidator(opts); - } - if (opts.body && opts.bodySerializer) { opts.body = opts.bodySerializer(opts.body); } + if (opts.requestValidator) { + await opts.requestValidator(opts); + } + const url = buildUrl(opts); return { opts, url }; diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/parameter-explode-false/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/parameter-explode-false/client/client.gen.ts index f68339318..711020aa6 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/parameter-explode-false/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/parameter-explode-false/client/client.gen.ts @@ -56,14 +56,14 @@ export const createClient = (config: Config = {}): Client => { }); } - if (opts.requestValidator) { - await opts.requestValidator(opts); - } - if (opts.body && opts.bodySerializer) { opts.serializedBody = opts.bodySerializer(opts.body); } + if (opts.requestValidator) { + await opts.requestValidator(opts); + } + // remove Content-Type header if body is empty to avoid sending invalid requests if (opts.serializedBody === undefined || opts.serializedBody === '') { opts.headers.delete('Content-Type'); diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@hey-api/client-fetch/sdk-nested-classes-instance/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@hey-api/client-fetch/sdk-nested-classes-instance/client/client.gen.ts index f68339318..711020aa6 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@hey-api/client-fetch/sdk-nested-classes-instance/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@hey-api/client-fetch/sdk-nested-classes-instance/client/client.gen.ts @@ -56,14 +56,14 @@ export const createClient = (config: Config = {}): Client => { }); } - if (opts.requestValidator) { - await opts.requestValidator(opts); - } - if (opts.body && opts.bodySerializer) { opts.serializedBody = opts.bodySerializer(opts.body); } + if (opts.requestValidator) { + await opts.requestValidator(opts); + } + // remove Content-Type header if body is empty to avoid sending invalid requests if (opts.serializedBody === undefined || opts.serializedBody === '') { opts.headers.delete('Content-Type'); diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@hey-api/client-fetch/sdk-nested-classes/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@hey-api/client-fetch/sdk-nested-classes/client/client.gen.ts index f68339318..711020aa6 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@hey-api/client-fetch/sdk-nested-classes/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@hey-api/client-fetch/sdk-nested-classes/client/client.gen.ts @@ -56,14 +56,14 @@ export const createClient = (config: Config = {}): Client => { }); } - if (opts.requestValidator) { - await opts.requestValidator(opts); - } - if (opts.body && opts.bodySerializer) { opts.serializedBody = opts.bodySerializer(opts.body); } + if (opts.requestValidator) { + await opts.requestValidator(opts); + } + // remove Content-Type header if body is empty to avoid sending invalid requests if (opts.serializedBody === undefined || opts.serializedBody === '') { opts.headers.delete('Content-Type'); diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@hey-api/sdk/default/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@hey-api/sdk/default/client/client.gen.ts index f68339318..711020aa6 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@hey-api/sdk/default/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@hey-api/sdk/default/client/client.gen.ts @@ -56,14 +56,14 @@ export const createClient = (config: Config = {}): Client => { }); } - if (opts.requestValidator) { - await opts.requestValidator(opts); - } - if (opts.body && opts.bodySerializer) { opts.serializedBody = opts.bodySerializer(opts.body); } + if (opts.requestValidator) { + await opts.requestValidator(opts); + } + // remove Content-Type header if body is empty to avoid sending invalid requests if (opts.serializedBody === undefined || opts.serializedBody === '') { opts.headers.delete('Content-Type'); diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@hey-api/sdk/instance/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@hey-api/sdk/instance/client/client.gen.ts index f68339318..711020aa6 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@hey-api/sdk/instance/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@hey-api/sdk/instance/client/client.gen.ts @@ -56,14 +56,14 @@ export const createClient = (config: Config = {}): Client => { }); } - if (opts.requestValidator) { - await opts.requestValidator(opts); - } - if (opts.body && opts.bodySerializer) { opts.serializedBody = opts.bodySerializer(opts.body); } + if (opts.requestValidator) { + await opts.requestValidator(opts); + } + // remove Content-Type header if body is empty to avoid sending invalid requests if (opts.serializedBody === undefined || opts.serializedBody === '') { opts.headers.delete('Content-Type'); diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@hey-api/sdk/throwOnError/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@hey-api/sdk/throwOnError/client/client.gen.ts index f68339318..711020aa6 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@hey-api/sdk/throwOnError/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@hey-api/sdk/throwOnError/client/client.gen.ts @@ -56,14 +56,14 @@ export const createClient = (config: Config = {}): Client => { }); } - if (opts.requestValidator) { - await opts.requestValidator(opts); - } - if (opts.body && opts.bodySerializer) { opts.serializedBody = opts.bodySerializer(opts.body); } + if (opts.requestValidator) { + await opts.requestValidator(opts); + } + // remove Content-Type header if body is empty to avoid sending invalid requests if (opts.serializedBody === undefined || opts.serializedBody === '') { opts.headers.delete('Content-Type'); diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@hey-api/transformers/type-format-valibot/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@hey-api/transformers/type-format-valibot/client/client.gen.ts index f68339318..711020aa6 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@hey-api/transformers/type-format-valibot/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@hey-api/transformers/type-format-valibot/client/client.gen.ts @@ -56,14 +56,14 @@ export const createClient = (config: Config = {}): Client => { }); } - if (opts.requestValidator) { - await opts.requestValidator(opts); - } - if (opts.body && opts.bodySerializer) { opts.serializedBody = opts.bodySerializer(opts.body); } + if (opts.requestValidator) { + await opts.requestValidator(opts); + } + // remove Content-Type header if body is empty to avoid sending invalid requests if (opts.serializedBody === undefined || opts.serializedBody === '') { opts.headers.delete('Content-Type'); diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@hey-api/transformers/type-format-zod/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@hey-api/transformers/type-format-zod/client/client.gen.ts index f68339318..711020aa6 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@hey-api/transformers/type-format-zod/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@hey-api/transformers/type-format-zod/client/client.gen.ts @@ -56,14 +56,14 @@ export const createClient = (config: Config = {}): Client => { }); } - if (opts.requestValidator) { - await opts.requestValidator(opts); - } - if (opts.body && opts.bodySerializer) { opts.serializedBody = opts.bodySerializer(opts.body); } + if (opts.requestValidator) { + await opts.requestValidator(opts); + } + // remove Content-Type header if body is empty to avoid sending invalid requests if (opts.serializedBody === undefined || opts.serializedBody === '') { opts.headers.delete('Content-Type'); diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@hey-api/typescript/transforms-read-write-custom-name/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@hey-api/typescript/transforms-read-write-custom-name/client/client.gen.ts index f68339318..711020aa6 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@hey-api/typescript/transforms-read-write-custom-name/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@hey-api/typescript/transforms-read-write-custom-name/client/client.gen.ts @@ -56,14 +56,14 @@ export const createClient = (config: Config = {}): Client => { }); } - if (opts.requestValidator) { - await opts.requestValidator(opts); - } - if (opts.body && opts.bodySerializer) { opts.serializedBody = opts.bodySerializer(opts.body); } + if (opts.requestValidator) { + await opts.requestValidator(opts); + } + // remove Content-Type header if body is empty to avoid sending invalid requests if (opts.serializedBody === undefined || opts.serializedBody === '') { opts.headers.delete('Content-Type'); diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@hey-api/typescript/transforms-read-write-ignore/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@hey-api/typescript/transforms-read-write-ignore/client/client.gen.ts index f68339318..711020aa6 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@hey-api/typescript/transforms-read-write-ignore/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@hey-api/typescript/transforms-read-write-ignore/client/client.gen.ts @@ -56,14 +56,14 @@ export const createClient = (config: Config = {}): Client => { }); } - if (opts.requestValidator) { - await opts.requestValidator(opts); - } - if (opts.body && opts.bodySerializer) { opts.serializedBody = opts.bodySerializer(opts.body); } + if (opts.requestValidator) { + await opts.requestValidator(opts); + } + // remove Content-Type header if body is empty to avoid sending invalid requests if (opts.serializedBody === undefined || opts.serializedBody === '') { opts.headers.delete('Content-Type'); diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@pinia/colada/fetch/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@pinia/colada/fetch/client/client.gen.ts index f68339318..711020aa6 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@pinia/colada/fetch/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@pinia/colada/fetch/client/client.gen.ts @@ -56,14 +56,14 @@ export const createClient = (config: Config = {}): Client => { }); } - if (opts.requestValidator) { - await opts.requestValidator(opts); - } - if (opts.body && opts.bodySerializer) { opts.serializedBody = opts.bodySerializer(opts.body); } + if (opts.requestValidator) { + await opts.requestValidator(opts); + } + // remove Content-Type header if body is empty to avoid sending invalid requests if (opts.serializedBody === undefined || opts.serializedBody === '') { opts.headers.delete('Content-Type'); diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@pinia/colada/group-by-tag/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@pinia/colada/group-by-tag/client/client.gen.ts index f68339318..711020aa6 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@pinia/colada/group-by-tag/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@pinia/colada/group-by-tag/client/client.gen.ts @@ -56,14 +56,14 @@ export const createClient = (config: Config = {}): Client => { }); } - if (opts.requestValidator) { - await opts.requestValidator(opts); - } - if (opts.body && opts.bodySerializer) { opts.serializedBody = opts.bodySerializer(opts.body); } + if (opts.requestValidator) { + await opts.requestValidator(opts); + } + // remove Content-Type header if body is empty to avoid sending invalid requests if (opts.serializedBody === undefined || opts.serializedBody === '') { opts.headers.delete('Content-Type'); diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/angular-query-experimental/asClass/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/angular-query-experimental/asClass/client/client.gen.ts index f68339318..711020aa6 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/angular-query-experimental/asClass/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/angular-query-experimental/asClass/client/client.gen.ts @@ -56,14 +56,14 @@ export const createClient = (config: Config = {}): Client => { }); } - if (opts.requestValidator) { - await opts.requestValidator(opts); - } - if (opts.body && opts.bodySerializer) { opts.serializedBody = opts.bodySerializer(opts.body); } + if (opts.requestValidator) { + await opts.requestValidator(opts); + } + // remove Content-Type header if body is empty to avoid sending invalid requests if (opts.serializedBody === undefined || opts.serializedBody === '') { opts.headers.delete('Content-Type'); diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/angular-query-experimental/axios/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/angular-query-experimental/axios/client/client.gen.ts index 06ff1ec77..e3e634266 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/angular-query-experimental/axios/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/angular-query-experimental/axios/client/client.gen.ts @@ -55,14 +55,14 @@ export const createClient = (config: Config = {}): Client => { }); } - if (opts.requestValidator) { - await opts.requestValidator(opts); - } - if (opts.body && opts.bodySerializer) { opts.body = opts.bodySerializer(opts.body); } + if (opts.requestValidator) { + await opts.requestValidator(opts); + } + const url = buildUrl(opts); return { opts, url }; diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/angular-query-experimental/fetch/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/angular-query-experimental/fetch/client/client.gen.ts index f68339318..711020aa6 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/angular-query-experimental/fetch/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/angular-query-experimental/fetch/client/client.gen.ts @@ -56,14 +56,14 @@ export const createClient = (config: Config = {}): Client => { }); } - if (opts.requestValidator) { - await opts.requestValidator(opts); - } - if (opts.body && opts.bodySerializer) { opts.serializedBody = opts.bodySerializer(opts.body); } + if (opts.requestValidator) { + await opts.requestValidator(opts); + } + // remove Content-Type header if body is empty to avoid sending invalid requests if (opts.serializedBody === undefined || opts.serializedBody === '') { opts.headers.delete('Content-Type'); diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/angular-query-experimental/name-builder/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/angular-query-experimental/name-builder/client/client.gen.ts index f68339318..711020aa6 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/angular-query-experimental/name-builder/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/angular-query-experimental/name-builder/client/client.gen.ts @@ -56,14 +56,14 @@ export const createClient = (config: Config = {}): Client => { }); } - if (opts.requestValidator) { - await opts.requestValidator(opts); - } - if (opts.body && opts.bodySerializer) { opts.serializedBody = opts.bodySerializer(opts.body); } + if (opts.requestValidator) { + await opts.requestValidator(opts); + } + // remove Content-Type header if body is empty to avoid sending invalid requests if (opts.serializedBody === undefined || opts.serializedBody === '') { opts.headers.delete('Content-Type'); diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/react-query/asClass/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/react-query/asClass/client/client.gen.ts index f68339318..711020aa6 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/react-query/asClass/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/react-query/asClass/client/client.gen.ts @@ -56,14 +56,14 @@ export const createClient = (config: Config = {}): Client => { }); } - if (opts.requestValidator) { - await opts.requestValidator(opts); - } - if (opts.body && opts.bodySerializer) { opts.serializedBody = opts.bodySerializer(opts.body); } + if (opts.requestValidator) { + await opts.requestValidator(opts); + } + // remove Content-Type header if body is empty to avoid sending invalid requests if (opts.serializedBody === undefined || opts.serializedBody === '') { opts.headers.delete('Content-Type'); diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/react-query/axios/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/react-query/axios/client/client.gen.ts index 06ff1ec77..e3e634266 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/react-query/axios/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/react-query/axios/client/client.gen.ts @@ -55,14 +55,14 @@ export const createClient = (config: Config = {}): Client => { }); } - if (opts.requestValidator) { - await opts.requestValidator(opts); - } - if (opts.body && opts.bodySerializer) { opts.body = opts.bodySerializer(opts.body); } + if (opts.requestValidator) { + await opts.requestValidator(opts); + } + const url = buildUrl(opts); return { opts, url }; diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/react-query/fetch/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/react-query/fetch/client/client.gen.ts index f68339318..711020aa6 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/react-query/fetch/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/react-query/fetch/client/client.gen.ts @@ -56,14 +56,14 @@ export const createClient = (config: Config = {}): Client => { }); } - if (opts.requestValidator) { - await opts.requestValidator(opts); - } - if (opts.body && opts.bodySerializer) { opts.serializedBody = opts.bodySerializer(opts.body); } + if (opts.requestValidator) { + await opts.requestValidator(opts); + } + // remove Content-Type header if body is empty to avoid sending invalid requests if (opts.serializedBody === undefined || opts.serializedBody === '') { opts.headers.delete('Content-Type'); diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/react-query/name-builder/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/react-query/name-builder/client/client.gen.ts index f68339318..711020aa6 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/react-query/name-builder/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/react-query/name-builder/client/client.gen.ts @@ -56,14 +56,14 @@ export const createClient = (config: Config = {}): Client => { }); } - if (opts.requestValidator) { - await opts.requestValidator(opts); - } - if (opts.body && opts.bodySerializer) { opts.serializedBody = opts.bodySerializer(opts.body); } + if (opts.requestValidator) { + await opts.requestValidator(opts); + } + // remove Content-Type header if body is empty to avoid sending invalid requests if (opts.serializedBody === undefined || opts.serializedBody === '') { opts.headers.delete('Content-Type'); diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/solid-query/asClass/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/solid-query/asClass/client/client.gen.ts index f68339318..711020aa6 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/solid-query/asClass/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/solid-query/asClass/client/client.gen.ts @@ -56,14 +56,14 @@ export const createClient = (config: Config = {}): Client => { }); } - if (opts.requestValidator) { - await opts.requestValidator(opts); - } - if (opts.body && opts.bodySerializer) { opts.serializedBody = opts.bodySerializer(opts.body); } + if (opts.requestValidator) { + await opts.requestValidator(opts); + } + // remove Content-Type header if body is empty to avoid sending invalid requests if (opts.serializedBody === undefined || opts.serializedBody === '') { opts.headers.delete('Content-Type'); diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/solid-query/axios/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/solid-query/axios/client/client.gen.ts index 06ff1ec77..e3e634266 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/solid-query/axios/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/solid-query/axios/client/client.gen.ts @@ -55,14 +55,14 @@ export const createClient = (config: Config = {}): Client => { }); } - if (opts.requestValidator) { - await opts.requestValidator(opts); - } - if (opts.body && opts.bodySerializer) { opts.body = opts.bodySerializer(opts.body); } + if (opts.requestValidator) { + await opts.requestValidator(opts); + } + const url = buildUrl(opts); return { opts, url }; diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/solid-query/fetch/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/solid-query/fetch/client/client.gen.ts index f68339318..711020aa6 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/solid-query/fetch/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/solid-query/fetch/client/client.gen.ts @@ -56,14 +56,14 @@ export const createClient = (config: Config = {}): Client => { }); } - if (opts.requestValidator) { - await opts.requestValidator(opts); - } - if (opts.body && opts.bodySerializer) { opts.serializedBody = opts.bodySerializer(opts.body); } + if (opts.requestValidator) { + await opts.requestValidator(opts); + } + // remove Content-Type header if body is empty to avoid sending invalid requests if (opts.serializedBody === undefined || opts.serializedBody === '') { opts.headers.delete('Content-Type'); diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/solid-query/name-builder/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/solid-query/name-builder/client/client.gen.ts index f68339318..711020aa6 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/solid-query/name-builder/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/solid-query/name-builder/client/client.gen.ts @@ -56,14 +56,14 @@ export const createClient = (config: Config = {}): Client => { }); } - if (opts.requestValidator) { - await opts.requestValidator(opts); - } - if (opts.body && opts.bodySerializer) { opts.serializedBody = opts.bodySerializer(opts.body); } + if (opts.requestValidator) { + await opts.requestValidator(opts); + } + // remove Content-Type header if body is empty to avoid sending invalid requests if (opts.serializedBody === undefined || opts.serializedBody === '') { opts.headers.delete('Content-Type'); diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/svelte-query/asClass/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/svelte-query/asClass/client/client.gen.ts index f68339318..711020aa6 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/svelte-query/asClass/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/svelte-query/asClass/client/client.gen.ts @@ -56,14 +56,14 @@ export const createClient = (config: Config = {}): Client => { }); } - if (opts.requestValidator) { - await opts.requestValidator(opts); - } - if (opts.body && opts.bodySerializer) { opts.serializedBody = opts.bodySerializer(opts.body); } + if (opts.requestValidator) { + await opts.requestValidator(opts); + } + // remove Content-Type header if body is empty to avoid sending invalid requests if (opts.serializedBody === undefined || opts.serializedBody === '') { opts.headers.delete('Content-Type'); diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/svelte-query/axios/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/svelte-query/axios/client/client.gen.ts index 06ff1ec77..e3e634266 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/svelte-query/axios/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/svelte-query/axios/client/client.gen.ts @@ -55,14 +55,14 @@ export const createClient = (config: Config = {}): Client => { }); } - if (opts.requestValidator) { - await opts.requestValidator(opts); - } - if (opts.body && opts.bodySerializer) { opts.body = opts.bodySerializer(opts.body); } + if (opts.requestValidator) { + await opts.requestValidator(opts); + } + const url = buildUrl(opts); return { opts, url }; diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/svelte-query/fetch/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/svelte-query/fetch/client/client.gen.ts index f68339318..711020aa6 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/svelte-query/fetch/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/svelte-query/fetch/client/client.gen.ts @@ -56,14 +56,14 @@ export const createClient = (config: Config = {}): Client => { }); } - if (opts.requestValidator) { - await opts.requestValidator(opts); - } - if (opts.body && opts.bodySerializer) { opts.serializedBody = opts.bodySerializer(opts.body); } + if (opts.requestValidator) { + await opts.requestValidator(opts); + } + // remove Content-Type header if body is empty to avoid sending invalid requests if (opts.serializedBody === undefined || opts.serializedBody === '') { opts.headers.delete('Content-Type'); diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/svelte-query/name-builder/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/svelte-query/name-builder/client/client.gen.ts index f68339318..711020aa6 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/svelte-query/name-builder/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/svelte-query/name-builder/client/client.gen.ts @@ -56,14 +56,14 @@ export const createClient = (config: Config = {}): Client => { }); } - if (opts.requestValidator) { - await opts.requestValidator(opts); - } - if (opts.body && opts.bodySerializer) { opts.serializedBody = opts.bodySerializer(opts.body); } + if (opts.requestValidator) { + await opts.requestValidator(opts); + } + // remove Content-Type header if body is empty to avoid sending invalid requests if (opts.serializedBody === undefined || opts.serializedBody === '') { opts.headers.delete('Content-Type'); diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/vue-query/asClass/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/vue-query/asClass/client/client.gen.ts index f68339318..711020aa6 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/vue-query/asClass/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/vue-query/asClass/client/client.gen.ts @@ -56,14 +56,14 @@ export const createClient = (config: Config = {}): Client => { }); } - if (opts.requestValidator) { - await opts.requestValidator(opts); - } - if (opts.body && opts.bodySerializer) { opts.serializedBody = opts.bodySerializer(opts.body); } + if (opts.requestValidator) { + await opts.requestValidator(opts); + } + // remove Content-Type header if body is empty to avoid sending invalid requests if (opts.serializedBody === undefined || opts.serializedBody === '') { opts.headers.delete('Content-Type'); diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/vue-query/axios/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/vue-query/axios/client/client.gen.ts index 06ff1ec77..e3e634266 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/vue-query/axios/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/vue-query/axios/client/client.gen.ts @@ -55,14 +55,14 @@ export const createClient = (config: Config = {}): Client => { }); } - if (opts.requestValidator) { - await opts.requestValidator(opts); - } - if (opts.body && opts.bodySerializer) { opts.body = opts.bodySerializer(opts.body); } + if (opts.requestValidator) { + await opts.requestValidator(opts); + } + const url = buildUrl(opts); return { opts, url }; diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/vue-query/fetch/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/vue-query/fetch/client/client.gen.ts index f68339318..711020aa6 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/vue-query/fetch/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/vue-query/fetch/client/client.gen.ts @@ -56,14 +56,14 @@ export const createClient = (config: Config = {}): Client => { }); } - if (opts.requestValidator) { - await opts.requestValidator(opts); - } - if (opts.body && opts.bodySerializer) { opts.serializedBody = opts.bodySerializer(opts.body); } + if (opts.requestValidator) { + await opts.requestValidator(opts); + } + // remove Content-Type header if body is empty to avoid sending invalid requests if (opts.serializedBody === undefined || opts.serializedBody === '') { opts.headers.delete('Content-Type'); diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/vue-query/name-builder/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/vue-query/name-builder/client/client.gen.ts index f68339318..711020aa6 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/vue-query/name-builder/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/vue-query/name-builder/client/client.gen.ts @@ -56,14 +56,14 @@ export const createClient = (config: Config = {}): Client => { }); } - if (opts.requestValidator) { - await opts.requestValidator(opts); - } - if (opts.body && opts.bodySerializer) { opts.serializedBody = opts.bodySerializer(opts.body); } + if (opts.requestValidator) { + await opts.requestValidator(opts); + } + // remove Content-Type header if body is empty to avoid sending invalid requests if (opts.serializedBody === undefined || opts.serializedBody === '') { opts.headers.delete('Content-Type'); diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/security-api-key/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/security-api-key/client/client.gen.ts index f68339318..711020aa6 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/security-api-key/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/security-api-key/client/client.gen.ts @@ -56,14 +56,14 @@ export const createClient = (config: Config = {}): Client => { }); } - if (opts.requestValidator) { - await opts.requestValidator(opts); - } - if (opts.body && opts.bodySerializer) { opts.serializedBody = opts.bodySerializer(opts.body); } + if (opts.requestValidator) { + await opts.requestValidator(opts); + } + // remove Content-Type header if body is empty to avoid sending invalid requests if (opts.serializedBody === undefined || opts.serializedBody === '') { opts.headers.delete('Content-Type'); diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/security-false/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/security-false/client/client.gen.ts index f68339318..711020aa6 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/security-false/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/security-false/client/client.gen.ts @@ -56,14 +56,14 @@ export const createClient = (config: Config = {}): Client => { }); } - if (opts.requestValidator) { - await opts.requestValidator(opts); - } - if (opts.body && opts.bodySerializer) { opts.serializedBody = opts.bodySerializer(opts.body); } + if (opts.requestValidator) { + await opts.requestValidator(opts); + } + // remove Content-Type header if body is empty to avoid sending invalid requests if (opts.serializedBody === undefined || opts.serializedBody === '') { opts.headers.delete('Content-Type'); diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/security-http-bearer/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/security-http-bearer/client/client.gen.ts index f68339318..711020aa6 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/security-http-bearer/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/security-http-bearer/client/client.gen.ts @@ -56,14 +56,14 @@ export const createClient = (config: Config = {}): Client => { }); } - if (opts.requestValidator) { - await opts.requestValidator(opts); - } - if (opts.body && opts.bodySerializer) { opts.serializedBody = opts.bodySerializer(opts.body); } + if (opts.requestValidator) { + await opts.requestValidator(opts); + } + // remove Content-Type header if body is empty to avoid sending invalid requests if (opts.serializedBody === undefined || opts.serializedBody === '') { opts.headers.delete('Content-Type'); diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/security-oauth2/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/security-oauth2/client/client.gen.ts index f68339318..711020aa6 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/security-oauth2/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/security-oauth2/client/client.gen.ts @@ -56,14 +56,14 @@ export const createClient = (config: Config = {}): Client => { }); } - if (opts.requestValidator) { - await opts.requestValidator(opts); - } - if (opts.body && opts.bodySerializer) { opts.serializedBody = opts.bodySerializer(opts.body); } + if (opts.requestValidator) { + await opts.requestValidator(opts); + } + // remove Content-Type header if body is empty to avoid sending invalid requests if (opts.serializedBody === undefined || opts.serializedBody === '') { opts.headers.delete('Content-Type'); diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/security-open-id-connect/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/security-open-id-connect/client/client.gen.ts index f68339318..711020aa6 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/security-open-id-connect/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/security-open-id-connect/client/client.gen.ts @@ -56,14 +56,14 @@ export const createClient = (config: Config = {}): Client => { }); } - if (opts.requestValidator) { - await opts.requestValidator(opts); - } - if (opts.body && opts.bodySerializer) { opts.serializedBody = opts.bodySerializer(opts.body); } + if (opts.requestValidator) { + await opts.requestValidator(opts); + } + // remove Content-Type header if body is empty to avoid sending invalid requests if (opts.serializedBody === undefined || opts.serializedBody === '') { opts.headers.delete('Content-Type'); diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/servers/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/servers/client/client.gen.ts index f68339318..711020aa6 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/servers/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/servers/client/client.gen.ts @@ -56,14 +56,14 @@ export const createClient = (config: Config = {}): Client => { }); } - if (opts.requestValidator) { - await opts.requestValidator(opts); - } - if (opts.body && opts.bodySerializer) { opts.serializedBody = opts.bodySerializer(opts.body); } + if (opts.requestValidator) { + await opts.requestValidator(opts); + } + // remove Content-Type header if body is empty to avoid sending invalid requests if (opts.serializedBody === undefined || opts.serializedBody === '') { opts.headers.delete('Content-Type'); diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/transformers-all-of/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/transformers-all-of/client/client.gen.ts index f68339318..711020aa6 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/transformers-all-of/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/transformers-all-of/client/client.gen.ts @@ -56,14 +56,14 @@ export const createClient = (config: Config = {}): Client => { }); } - if (opts.requestValidator) { - await opts.requestValidator(opts); - } - if (opts.body && opts.bodySerializer) { opts.serializedBody = opts.bodySerializer(opts.body); } + if (opts.requestValidator) { + await opts.requestValidator(opts); + } + // remove Content-Type header if body is empty to avoid sending invalid requests if (opts.serializedBody === undefined || opts.serializedBody === '') { opts.headers.delete('Content-Type'); diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/transformers-any-of-null/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/transformers-any-of-null/client/client.gen.ts index f68339318..711020aa6 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/transformers-any-of-null/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/transformers-any-of-null/client/client.gen.ts @@ -56,14 +56,14 @@ export const createClient = (config: Config = {}): Client => { }); } - if (opts.requestValidator) { - await opts.requestValidator(opts); - } - if (opts.body && opts.bodySerializer) { opts.serializedBody = opts.bodySerializer(opts.body); } + if (opts.requestValidator) { + await opts.requestValidator(opts); + } + // remove Content-Type header if body is empty to avoid sending invalid requests if (opts.serializedBody === undefined || opts.serializedBody === '') { opts.headers.delete('Content-Type'); diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/transformers-array/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/transformers-array/client/client.gen.ts index f68339318..711020aa6 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/transformers-array/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/transformers-array/client/client.gen.ts @@ -56,14 +56,14 @@ export const createClient = (config: Config = {}): Client => { }); } - if (opts.requestValidator) { - await opts.requestValidator(opts); - } - if (opts.body && opts.bodySerializer) { opts.serializedBody = opts.bodySerializer(opts.body); } + if (opts.requestValidator) { + await opts.requestValidator(opts); + } + // remove Content-Type header if body is empty to avoid sending invalid requests if (opts.serializedBody === undefined || opts.serializedBody === '') { opts.headers.delete('Content-Type'); diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/transforms-read-write/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/transforms-read-write/client/client.gen.ts index f68339318..711020aa6 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/transforms-read-write/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/transforms-read-write/client/client.gen.ts @@ -56,14 +56,14 @@ export const createClient = (config: Config = {}): Client => { }); } - if (opts.requestValidator) { - await opts.requestValidator(opts); - } - if (opts.body && opts.bodySerializer) { opts.serializedBody = opts.bodySerializer(opts.body); } + if (opts.requestValidator) { + await opts.requestValidator(opts); + } + // remove Content-Type header if body is empty to avoid sending invalid requests if (opts.serializedBody === undefined || opts.serializedBody === '') { opts.headers.delete('Content-Type'); diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/body-response-text-plain/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/body-response-text-plain/client/client.gen.ts index f68339318..711020aa6 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/body-response-text-plain/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/body-response-text-plain/client/client.gen.ts @@ -56,14 +56,14 @@ export const createClient = (config: Config = {}): Client => { }); } - if (opts.requestValidator) { - await opts.requestValidator(opts); - } - if (opts.body && opts.bodySerializer) { opts.serializedBody = opts.bodySerializer(opts.body); } + if (opts.requestValidator) { + await opts.requestValidator(opts); + } + // remove Content-Type header if body is empty to avoid sending invalid requests if (opts.serializedBody === undefined || opts.serializedBody === '') { opts.headers.delete('Content-Type'); diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-axios/base-url-false/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-axios/base-url-false/client/client.gen.ts index 06ff1ec77..e3e634266 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-axios/base-url-false/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-axios/base-url-false/client/client.gen.ts @@ -55,14 +55,14 @@ export const createClient = (config: Config = {}): Client => { }); } - if (opts.requestValidator) { - await opts.requestValidator(opts); - } - if (opts.body && opts.bodySerializer) { opts.body = opts.bodySerializer(opts.body); } + if (opts.requestValidator) { + await opts.requestValidator(opts); + } + const url = buildUrl(opts); return { opts, url }; diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-axios/base-url-number/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-axios/base-url-number/client/client.gen.ts index 06ff1ec77..e3e634266 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-axios/base-url-number/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-axios/base-url-number/client/client.gen.ts @@ -55,14 +55,14 @@ export const createClient = (config: Config = {}): Client => { }); } - if (opts.requestValidator) { - await opts.requestValidator(opts); - } - if (opts.body && opts.bodySerializer) { opts.body = opts.bodySerializer(opts.body); } + if (opts.requestValidator) { + await opts.requestValidator(opts); + } + const url = buildUrl(opts); return { opts, url }; diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-axios/base-url-strict/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-axios/base-url-strict/client/client.gen.ts index 06ff1ec77..e3e634266 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-axios/base-url-strict/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-axios/base-url-strict/client/client.gen.ts @@ -55,14 +55,14 @@ export const createClient = (config: Config = {}): Client => { }); } - if (opts.requestValidator) { - await opts.requestValidator(opts); - } - if (opts.body && opts.bodySerializer) { opts.body = opts.bodySerializer(opts.body); } + if (opts.requestValidator) { + await opts.requestValidator(opts); + } + const url = buildUrl(opts); return { opts, url }; diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-axios/base-url-string/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-axios/base-url-string/client/client.gen.ts index 06ff1ec77..e3e634266 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-axios/base-url-string/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-axios/base-url-string/client/client.gen.ts @@ -55,14 +55,14 @@ export const createClient = (config: Config = {}): Client => { }); } - if (opts.requestValidator) { - await opts.requestValidator(opts); - } - if (opts.body && opts.bodySerializer) { opts.body = opts.bodySerializer(opts.body); } + if (opts.requestValidator) { + await opts.requestValidator(opts); + } + const url = buildUrl(opts); return { opts, url }; diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-axios/clean-false/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-axios/clean-false/client/client.gen.ts index 06ff1ec77..e3e634266 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-axios/clean-false/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-axios/clean-false/client/client.gen.ts @@ -55,14 +55,14 @@ export const createClient = (config: Config = {}): Client => { }); } - if (opts.requestValidator) { - await opts.requestValidator(opts); - } - if (opts.body && opts.bodySerializer) { opts.body = opts.bodySerializer(opts.body); } + if (opts.requestValidator) { + await opts.requestValidator(opts); + } + const url = buildUrl(opts); return { opts, url }; diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-axios/default/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-axios/default/client/client.gen.ts index 06ff1ec77..e3e634266 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-axios/default/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-axios/default/client/client.gen.ts @@ -55,14 +55,14 @@ export const createClient = (config: Config = {}): Client => { }); } - if (opts.requestValidator) { - await opts.requestValidator(opts); - } - if (opts.body && opts.bodySerializer) { opts.body = opts.bodySerializer(opts.body); } + if (opts.requestValidator) { + await opts.requestValidator(opts); + } + const url = buildUrl(opts); return { opts, url }; diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-axios/sdk-client-optional/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-axios/sdk-client-optional/client/client.gen.ts index 06ff1ec77..e3e634266 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-axios/sdk-client-optional/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-axios/sdk-client-optional/client/client.gen.ts @@ -55,14 +55,14 @@ export const createClient = (config: Config = {}): Client => { }); } - if (opts.requestValidator) { - await opts.requestValidator(opts); - } - if (opts.body && opts.bodySerializer) { opts.body = opts.bodySerializer(opts.body); } + if (opts.requestValidator) { + await opts.requestValidator(opts); + } + const url = buildUrl(opts); return { opts, url }; diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-axios/sdk-client-required/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-axios/sdk-client-required/client/client.gen.ts index 06ff1ec77..e3e634266 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-axios/sdk-client-required/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-axios/sdk-client-required/client/client.gen.ts @@ -55,14 +55,14 @@ export const createClient = (config: Config = {}): Client => { }); } - if (opts.requestValidator) { - await opts.requestValidator(opts); - } - if (opts.body && opts.bodySerializer) { opts.body = opts.bodySerializer(opts.body); } + if (opts.requestValidator) { + await opts.requestValidator(opts); + } + const url = buildUrl(opts); return { opts, url }; diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-axios/tsconfig-nodenext-sdk/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-axios/tsconfig-nodenext-sdk/client/client.gen.ts index 25d7be4f2..3d0e0fc75 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-axios/tsconfig-nodenext-sdk/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-axios/tsconfig-nodenext-sdk/client/client.gen.ts @@ -55,14 +55,14 @@ export const createClient = (config: Config = {}): Client => { }); } - if (opts.requestValidator) { - await opts.requestValidator(opts); - } - if (opts.body && opts.bodySerializer) { opts.body = opts.bodySerializer(opts.body); } + if (opts.requestValidator) { + await opts.requestValidator(opts); + } + const url = buildUrl(opts); return { opts, url }; diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-fetch/base-url-false/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-fetch/base-url-false/client/client.gen.ts index f68339318..711020aa6 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-fetch/base-url-false/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-fetch/base-url-false/client/client.gen.ts @@ -56,14 +56,14 @@ export const createClient = (config: Config = {}): Client => { }); } - if (opts.requestValidator) { - await opts.requestValidator(opts); - } - if (opts.body && opts.bodySerializer) { opts.serializedBody = opts.bodySerializer(opts.body); } + if (opts.requestValidator) { + await opts.requestValidator(opts); + } + // remove Content-Type header if body is empty to avoid sending invalid requests if (opts.serializedBody === undefined || opts.serializedBody === '') { opts.headers.delete('Content-Type'); diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-fetch/base-url-number/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-fetch/base-url-number/client/client.gen.ts index f68339318..711020aa6 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-fetch/base-url-number/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-fetch/base-url-number/client/client.gen.ts @@ -56,14 +56,14 @@ export const createClient = (config: Config = {}): Client => { }); } - if (opts.requestValidator) { - await opts.requestValidator(opts); - } - if (opts.body && opts.bodySerializer) { opts.serializedBody = opts.bodySerializer(opts.body); } + if (opts.requestValidator) { + await opts.requestValidator(opts); + } + // remove Content-Type header if body is empty to avoid sending invalid requests if (opts.serializedBody === undefined || opts.serializedBody === '') { opts.headers.delete('Content-Type'); diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-fetch/base-url-strict/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-fetch/base-url-strict/client/client.gen.ts index f68339318..711020aa6 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-fetch/base-url-strict/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-fetch/base-url-strict/client/client.gen.ts @@ -56,14 +56,14 @@ export const createClient = (config: Config = {}): Client => { }); } - if (opts.requestValidator) { - await opts.requestValidator(opts); - } - if (opts.body && opts.bodySerializer) { opts.serializedBody = opts.bodySerializer(opts.body); } + if (opts.requestValidator) { + await opts.requestValidator(opts); + } + // remove Content-Type header if body is empty to avoid sending invalid requests if (opts.serializedBody === undefined || opts.serializedBody === '') { opts.headers.delete('Content-Type'); diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-fetch/base-url-string/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-fetch/base-url-string/client/client.gen.ts index f68339318..711020aa6 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-fetch/base-url-string/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-fetch/base-url-string/client/client.gen.ts @@ -56,14 +56,14 @@ export const createClient = (config: Config = {}): Client => { }); } - if (opts.requestValidator) { - await opts.requestValidator(opts); - } - if (opts.body && opts.bodySerializer) { opts.serializedBody = opts.bodySerializer(opts.body); } + if (opts.requestValidator) { + await opts.requestValidator(opts); + } + // remove Content-Type header if body is empty to avoid sending invalid requests if (opts.serializedBody === undefined || opts.serializedBody === '') { opts.headers.delete('Content-Type'); diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-fetch/clean-false/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-fetch/clean-false/client/client.gen.ts index f68339318..711020aa6 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-fetch/clean-false/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-fetch/clean-false/client/client.gen.ts @@ -56,14 +56,14 @@ export const createClient = (config: Config = {}): Client => { }); } - if (opts.requestValidator) { - await opts.requestValidator(opts); - } - if (opts.body && opts.bodySerializer) { opts.serializedBody = opts.bodySerializer(opts.body); } + if (opts.requestValidator) { + await opts.requestValidator(opts); + } + // remove Content-Type header if body is empty to avoid sending invalid requests if (opts.serializedBody === undefined || opts.serializedBody === '') { opts.headers.delete('Content-Type'); diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-fetch/default/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-fetch/default/client/client.gen.ts index f68339318..711020aa6 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-fetch/default/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-fetch/default/client/client.gen.ts @@ -56,14 +56,14 @@ export const createClient = (config: Config = {}): Client => { }); } - if (opts.requestValidator) { - await opts.requestValidator(opts); - } - if (opts.body && opts.bodySerializer) { opts.serializedBody = opts.bodySerializer(opts.body); } + if (opts.requestValidator) { + await opts.requestValidator(opts); + } + // remove Content-Type header if body is empty to avoid sending invalid requests if (opts.serializedBody === undefined || opts.serializedBody === '') { opts.headers.delete('Content-Type'); diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-fetch/sdk-client-optional/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-fetch/sdk-client-optional/client/client.gen.ts index f68339318..711020aa6 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-fetch/sdk-client-optional/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-fetch/sdk-client-optional/client/client.gen.ts @@ -56,14 +56,14 @@ export const createClient = (config: Config = {}): Client => { }); } - if (opts.requestValidator) { - await opts.requestValidator(opts); - } - if (opts.body && opts.bodySerializer) { opts.serializedBody = opts.bodySerializer(opts.body); } + if (opts.requestValidator) { + await opts.requestValidator(opts); + } + // remove Content-Type header if body is empty to avoid sending invalid requests if (opts.serializedBody === undefined || opts.serializedBody === '') { opts.headers.delete('Content-Type'); diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-fetch/sdk-client-required/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-fetch/sdk-client-required/client/client.gen.ts index f68339318..711020aa6 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-fetch/sdk-client-required/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-fetch/sdk-client-required/client/client.gen.ts @@ -56,14 +56,14 @@ export const createClient = (config: Config = {}): Client => { }); } - if (opts.requestValidator) { - await opts.requestValidator(opts); - } - if (opts.body && opts.bodySerializer) { opts.serializedBody = opts.bodySerializer(opts.body); } + if (opts.requestValidator) { + await opts.requestValidator(opts); + } + // remove Content-Type header if body is empty to avoid sending invalid requests if (opts.serializedBody === undefined || opts.serializedBody === '') { opts.headers.delete('Content-Type'); diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-fetch/tsconfig-nodenext-sdk/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-fetch/tsconfig-nodenext-sdk/client/client.gen.ts index 136c0eb5d..e46da8b85 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-fetch/tsconfig-nodenext-sdk/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-fetch/tsconfig-nodenext-sdk/client/client.gen.ts @@ -56,14 +56,14 @@ export const createClient = (config: Config = {}): Client => { }); } - if (opts.requestValidator) { - await opts.requestValidator(opts); - } - if (opts.body && opts.bodySerializer) { opts.serializedBody = opts.bodySerializer(opts.body); } + if (opts.requestValidator) { + await opts.requestValidator(opts); + } + // remove Content-Type header if body is empty to avoid sending invalid requests if (opts.serializedBody === undefined || opts.serializedBody === '') { opts.headers.delete('Content-Type'); diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-next/base-url-false/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-next/base-url-false/client/client.gen.ts index 9a3f20891..3d484fd53 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-next/base-url-false/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-next/base-url-false/client/client.gen.ts @@ -55,14 +55,14 @@ export const createClient = (config: Config = {}): Client => { }); } - if (opts.requestValidator) { - await opts.requestValidator(opts); - } - if (opts.body && opts.bodySerializer) { opts.serializedBody = opts.bodySerializer(opts.body); } + if (opts.requestValidator) { + await opts.requestValidator(opts); + } + // remove Content-Type header if body is empty to avoid sending invalid requests if (opts.serializedBody === undefined || opts.serializedBody === '') { opts.headers.delete('Content-Type'); diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-next/base-url-number/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-next/base-url-number/client/client.gen.ts index 9a3f20891..3d484fd53 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-next/base-url-number/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-next/base-url-number/client/client.gen.ts @@ -55,14 +55,14 @@ export const createClient = (config: Config = {}): Client => { }); } - if (opts.requestValidator) { - await opts.requestValidator(opts); - } - if (opts.body && opts.bodySerializer) { opts.serializedBody = opts.bodySerializer(opts.body); } + if (opts.requestValidator) { + await opts.requestValidator(opts); + } + // remove Content-Type header if body is empty to avoid sending invalid requests if (opts.serializedBody === undefined || opts.serializedBody === '') { opts.headers.delete('Content-Type'); diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-next/base-url-strict/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-next/base-url-strict/client/client.gen.ts index 9a3f20891..3d484fd53 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-next/base-url-strict/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-next/base-url-strict/client/client.gen.ts @@ -55,14 +55,14 @@ export const createClient = (config: Config = {}): Client => { }); } - if (opts.requestValidator) { - await opts.requestValidator(opts); - } - if (opts.body && opts.bodySerializer) { opts.serializedBody = opts.bodySerializer(opts.body); } + if (opts.requestValidator) { + await opts.requestValidator(opts); + } + // remove Content-Type header if body is empty to avoid sending invalid requests if (opts.serializedBody === undefined || opts.serializedBody === '') { opts.headers.delete('Content-Type'); diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-next/base-url-string/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-next/base-url-string/client/client.gen.ts index 9a3f20891..3d484fd53 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-next/base-url-string/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-next/base-url-string/client/client.gen.ts @@ -55,14 +55,14 @@ export const createClient = (config: Config = {}): Client => { }); } - if (opts.requestValidator) { - await opts.requestValidator(opts); - } - if (opts.body && opts.bodySerializer) { opts.serializedBody = opts.bodySerializer(opts.body); } + if (opts.requestValidator) { + await opts.requestValidator(opts); + } + // remove Content-Type header if body is empty to avoid sending invalid requests if (opts.serializedBody === undefined || opts.serializedBody === '') { opts.headers.delete('Content-Type'); diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-next/clean-false/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-next/clean-false/client/client.gen.ts index 9a3f20891..3d484fd53 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-next/clean-false/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-next/clean-false/client/client.gen.ts @@ -55,14 +55,14 @@ export const createClient = (config: Config = {}): Client => { }); } - if (opts.requestValidator) { - await opts.requestValidator(opts); - } - if (opts.body && opts.bodySerializer) { opts.serializedBody = opts.bodySerializer(opts.body); } + if (opts.requestValidator) { + await opts.requestValidator(opts); + } + // remove Content-Type header if body is empty to avoid sending invalid requests if (opts.serializedBody === undefined || opts.serializedBody === '') { opts.headers.delete('Content-Type'); diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-next/default/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-next/default/client/client.gen.ts index 9a3f20891..3d484fd53 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-next/default/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-next/default/client/client.gen.ts @@ -55,14 +55,14 @@ export const createClient = (config: Config = {}): Client => { }); } - if (opts.requestValidator) { - await opts.requestValidator(opts); - } - if (opts.body && opts.bodySerializer) { opts.serializedBody = opts.bodySerializer(opts.body); } + if (opts.requestValidator) { + await opts.requestValidator(opts); + } + // remove Content-Type header if body is empty to avoid sending invalid requests if (opts.serializedBody === undefined || opts.serializedBody === '') { opts.headers.delete('Content-Type'); diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-next/sdk-client-optional/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-next/sdk-client-optional/client/client.gen.ts index 9a3f20891..3d484fd53 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-next/sdk-client-optional/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-next/sdk-client-optional/client/client.gen.ts @@ -55,14 +55,14 @@ export const createClient = (config: Config = {}): Client => { }); } - if (opts.requestValidator) { - await opts.requestValidator(opts); - } - if (opts.body && opts.bodySerializer) { opts.serializedBody = opts.bodySerializer(opts.body); } + if (opts.requestValidator) { + await opts.requestValidator(opts); + } + // remove Content-Type header if body is empty to avoid sending invalid requests if (opts.serializedBody === undefined || opts.serializedBody === '') { opts.headers.delete('Content-Type'); diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-next/sdk-client-required/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-next/sdk-client-required/client/client.gen.ts index 9a3f20891..3d484fd53 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-next/sdk-client-required/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-next/sdk-client-required/client/client.gen.ts @@ -55,14 +55,14 @@ export const createClient = (config: Config = {}): Client => { }); } - if (opts.requestValidator) { - await opts.requestValidator(opts); - } - if (opts.body && opts.bodySerializer) { opts.serializedBody = opts.bodySerializer(opts.body); } + if (opts.requestValidator) { + await opts.requestValidator(opts); + } + // remove Content-Type header if body is empty to avoid sending invalid requests if (opts.serializedBody === undefined || opts.serializedBody === '') { opts.headers.delete('Content-Type'); diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-next/tsconfig-nodenext-sdk/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-next/tsconfig-nodenext-sdk/client/client.gen.ts index 3c5df8c21..a14986a82 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-next/tsconfig-nodenext-sdk/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-next/tsconfig-nodenext-sdk/client/client.gen.ts @@ -55,14 +55,14 @@ export const createClient = (config: Config = {}): Client => { }); } - if (opts.requestValidator) { - await opts.requestValidator(opts); - } - if (opts.body && opts.bodySerializer) { opts.serializedBody = opts.bodySerializer(opts.body); } + if (opts.requestValidator) { + await opts.requestValidator(opts); + } + // remove Content-Type header if body is empty to avoid sending invalid requests if (opts.serializedBody === undefined || opts.serializedBody === '') { opts.headers.delete('Content-Type'); diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/client-custom/bundle/client/index.cjs b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/client-custom/bundle/client/index.cjs index 897f77d7f..3bec70e2b 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/client-custom/bundle/client/index.cjs +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/client-custom/bundle/client/index.cjs @@ -1,2 +1,2 @@ -'use strict';var A=async(t,r)=>{let e=typeof r=="function"?await r(t):r;if(e)return t.scheme==="bearer"?`Bearer ${e}`:t.scheme==="basic"?`Basic ${btoa(e)}`:e};var w=(t,r,e)=>{typeof e=="string"||e instanceof Blob?t.append(r,e):t.append(r,JSON.stringify(e));},P=(t,r,e)=>{typeof e=="string"?t.append(r,e):t.append(r,JSON.stringify(e));},_={bodySerializer:t=>{let r=new FormData;return Object.entries(t).forEach(([e,o])=>{o!=null&&(Array.isArray(o)?o.forEach(s=>w(r,e,s)):w(r,e,o));}),r}},x={bodySerializer:t=>JSON.stringify(t,(r,e)=>typeof e=="bigint"?e.toString():e)},U={bodySerializer:t=>{let r=new URLSearchParams;return Object.entries(t).forEach(([e,o])=>{o!=null&&(Array.isArray(o)?o.forEach(s=>P(r,e,s)):P(r,e,o));}),r.toString()}};var D=t=>{switch(t){case "label":return ".";case "matrix":return ";";case "simple":return ",";default:return "&"}},F=t=>{switch(t){case "form":return ",";case "pipeDelimited":return "|";case "spaceDelimited":return "%20";default:return ","}},M=t=>{switch(t){case "label":return ".";case "matrix":return ";";case "simple":return ",";default:return "&"}},O=({allowReserved:t,explode:r,name:e,style:o,value:s})=>{if(!r){let n=(t?s:s.map(c=>encodeURIComponent(c))).join(F(o));switch(o){case "label":return `.${n}`;case "matrix":return `;${e}=${n}`;case "simple":return n;default:return `${e}=${n}`}}let a=D(o),i=s.map(n=>o==="label"||o==="simple"?t?n:encodeURIComponent(n):m({allowReserved:t,name:e,value:n})).join(a);return o==="label"||o==="matrix"?a+i:i},m=({allowReserved:t,name:r,value:e})=>{if(e==null)return "";if(typeof e=="object")throw new Error("Deeply-nested arrays/objects aren\u2019t supported. Provide your own `querySerializer()` to handle these.");return `${r}=${t?e:encodeURIComponent(e)}`},R=({allowReserved:t,explode:r,name:e,style:o,value:s,valueOnly:a})=>{if(s instanceof Date)return a?s.toISOString():`${e}=${s.toISOString()}`;if(o!=="deepObject"&&!r){let c=[];Object.entries(s).forEach(([f,d])=>{c=[...c,f,t?d:encodeURIComponent(d)];});let p=c.join(",");switch(o){case "form":return `${e}=${p}`;case "label":return `.${p}`;case "matrix":return `;${e}=${p}`;default:return p}}let i=M(o),n=Object.entries(s).map(([c,p])=>m({allowReserved:t,name:o==="deepObject"?`${e}[${c}]`:c,value:p})).join(i);return o==="label"||o==="matrix"?i+n:n};var H=/\{[^{}]+\}/g,B=({path:t,url:r})=>{let e=r,o=r.match(H);if(o)for(let s of o){let a=false,i=s.substring(1,s.length-1),n="simple";i.endsWith("*")&&(a=true,i=i.substring(0,i.length-1)),i.startsWith(".")?(i=i.substring(1),n="label"):i.startsWith(";")&&(i=i.substring(1),n="matrix");let c=t[i];if(c==null)continue;if(Array.isArray(c)){e=e.replace(s,O({explode:a,name:i,style:n,value:c}));continue}if(typeof c=="object"){e=e.replace(s,R({explode:a,name:i,style:n,value:c,valueOnly:true}));continue}if(n==="matrix"){e=e.replace(s,`;${m({name:i,value:c})}`);continue}let p=encodeURIComponent(n==="label"?`.${c}`:c);e=e.replace(s,p);}return e},k=({allowReserved:t,array:r,object:e}={})=>s=>{let a=[];if(s&&typeof s=="object")for(let i in s){let n=s[i];if(n!=null)if(Array.isArray(n)){let c=O({allowReserved:t,explode:true,name:i,style:"form",value:n,...r});c&&a.push(c);}else if(typeof n=="object"){let c=R({allowReserved:t,explode:true,name:i,style:"deepObject",value:n,...e});c&&a.push(c);}else {let c=m({allowReserved:t,name:i,value:n});c&&a.push(c);}}return a.join("&")},I=t=>{if(!t)return "stream";let r=t.split(";")[0]?.trim();if(r){if(r.startsWith("application/json")||r.endsWith("+json"))return "json";if(r==="multipart/form-data")return "formData";if(["application/","audio/","image/","video/"].some(e=>r.startsWith(e)))return "blob";if(r.startsWith("text/"))return "text"}},W=(t,r)=>r?!!(t.headers.has(r)||t.query?.[r]||t.headers.get("Cookie")?.includes(`${r}=`)):false,T=async({security:t,...r})=>{for(let e of t){if(W(r,e.name))continue;let o=await A(e,r.auth);if(!o)continue;let s=e.name??"Authorization";switch(e.in){case "query":r.query||(r.query={}),r.query[s]=o;break;case "cookie":r.headers.append("Cookie",`${s}=${o}`);break;case "header":default:r.headers.set(s,o);break}}},q=t=>N({baseUrl:t.baseUrl,path:t.path,query:t.query,querySerializer:typeof t.querySerializer=="function"?t.querySerializer:k(t.querySerializer),url:t.url}),N=({baseUrl:t,path:r,query:e,querySerializer:o,url:s})=>{let a=s.startsWith("/")?s:`/${s}`,i=(t??"")+a;r&&(i=B({path:r,url:i}));let n=e?o(e):"";return n.startsWith("?")&&(n=n.substring(1)),n&&(i+=`?${n}`),i},z=(t,r)=>{let e={...t,...r};return e.baseUrl?.endsWith("/")&&(e.baseUrl=e.baseUrl.substring(0,e.baseUrl.length-1)),e.headers=C(t.headers,r.headers),e},C=(...t)=>{let r=new Headers;for(let e of t){if(!e||typeof e!="object")continue;let o=e instanceof Headers?e.entries():Object.entries(e);for(let[s,a]of o)if(a===null)r.delete(s);else if(Array.isArray(a))for(let i of a)r.append(s,i);else a!==void 0&&r.set(s,typeof a=="object"?JSON.stringify(a):a);}return r},g=class{_fns;constructor(){this._fns=[];}clear(){this._fns=[];}getInterceptorIndex(r){return typeof r=="number"?this._fns[r]?r:-1:this._fns.indexOf(r)}exists(r){let e=this.getInterceptorIndex(r);return !!this._fns[e]}eject(r){let e=this.getInterceptorIndex(r);this._fns[e]&&(this._fns[e]=null);}update(r,e){let o=this.getInterceptorIndex(r);return this._fns[o]?(this._fns[o]=e,r):false}use(r){return this._fns=[...this._fns,r],this._fns.length-1}},E=()=>({error:new g,request:new g,response:new g}),Q=k({allowReserved:false,array:{explode:true,style:"form"},object:{explode:true,style:"deepObject"}}),V={"Content-Type":"application/json"},j=(t={})=>({...x,headers:V,parseAs:"auto",querySerializer:Q,...t});var J=(t={})=>{let r=z(j(),t),e=()=>({...r}),o=i=>(r=z(r,i),e()),s=E(),a=async i=>{let n={...r,...i,fetch:i.fetch??r.fetch??globalThis.fetch,headers:C(r.headers,i.headers)};n.security&&await T({...n,security:n.security}),n.requestValidator&&await n.requestValidator(n),n.body&&n.bodySerializer&&(n.body=n.bodySerializer(n.body)),(n.body===void 0||n.body==="")&&n.headers.delete("Content-Type");let c=q(n),p={redirect:"follow",...n},f=new Request(c,p);for(let u of s.request._fns)u&&(f=await u(f,n));let d=n.fetch,l=await d(f);for(let u of s.response._fns)u&&(l=await u(l,f,n));let b={request:f,response:l};if(l.ok){if(l.status===204||l.headers.get("Content-Length")==="0")return {data:{},...b};let u=(n.parseAs==="auto"?I(l.headers.get("Content-Type")):n.parseAs)??"json",h;switch(u){case "arrayBuffer":case "blob":case "formData":case "json":case "text":h=await l[u]();break;case "stream":return {data:l.body,...b}}return u==="json"&&(n.responseValidator&&await n.responseValidator(h),n.responseTransformer&&(h=await n.responseTransformer(h))),{data:h,...b}}let S=await l.text();try{S=JSON.parse(S);}catch{}let y=S;for(let u of s.error._fns)u&&(y=await u(S,l,f,n));if(y=y||{},n.throwOnError)throw y;return {error:y,...b}};return {buildUrl:q,connect:i=>a({...i,method:"CONNECT"}),delete:i=>a({...i,method:"DELETE"}),get:i=>a({...i,method:"GET"}),getConfig:e,head:i=>a({...i,method:"HEAD"}),interceptors:s,options:i=>a({...i,method:"OPTIONS"}),patch:i=>a({...i,method:"PATCH"}),post:i=>a({...i,method:"POST"}),put:i=>a({...i,method:"PUT"}),request:a,setConfig:o,trace:i=>a({...i,method:"TRACE"})}};var K={$body_:"body",$headers_:"headers",$path_:"path",$query_:"query"},L=Object.entries(K),$=(t,r)=>{r||(r=new Map);for(let e of t)"in"in e?e.key&&r.set(e.key,{in:e.in,map:e.map}):e.args&&$(e.args,r);return r},G=t=>{for(let[r,e]of Object.entries(t))e&&typeof e=="object"&&!Object.keys(e).length&&delete t[r];},v=(t,r)=>{let e={body:{},headers:{},path:{},query:{}},o=$(r),s;for(let[a,i]of t.entries())if(r[a]&&(s=r[a]),!!s)if("in"in s)if(s.key){let n=o.get(s.key),c=n.map||s.key;e[n.in][c]=i;}else e.body=i;else for(let[n,c]of Object.entries(i??{})){let p=o.get(n);if(p){let f=p.map||n;e[p.in][f]=c;}else {let f=L.find(([d])=>n.startsWith(d));if(f){let[d,l]=f;e[l][n.slice(d.length)]=c;}else for(let[d,l]of Object.entries(s.allowExtra??{}))if(l){e[d][n]=c;break}}}return G(e),e};exports.buildClientParams=v;exports.createClient=J;exports.createConfig=j;exports.formDataBodySerializer=_;exports.jsonBodySerializer=x;exports.urlSearchParamsBodySerializer=U;//# sourceMappingURL=index.cjs.map +'use strict';var A=async(t,r)=>{let e=typeof r=="function"?await r(t):r;if(e)return t.scheme==="bearer"?`Bearer ${e}`:t.scheme==="basic"?`Basic ${btoa(e)}`:e};var w=(t,r,e)=>{typeof e=="string"||e instanceof Blob?t.append(r,e):t.append(r,JSON.stringify(e));},P=(t,r,e)=>{typeof e=="string"?t.append(r,e):t.append(r,JSON.stringify(e));},_={bodySerializer:t=>{let r=new FormData;return Object.entries(t).forEach(([e,o])=>{o!=null&&(Array.isArray(o)?o.forEach(s=>w(r,e,s)):w(r,e,o));}),r}},x={bodySerializer:t=>JSON.stringify(t,(r,e)=>typeof e=="bigint"?e.toString():e)},U={bodySerializer:t=>{let r=new URLSearchParams;return Object.entries(t).forEach(([e,o])=>{o!=null&&(Array.isArray(o)?o.forEach(s=>P(r,e,s)):P(r,e,o));}),r.toString()}};var D=t=>{switch(t){case "label":return ".";case "matrix":return ";";case "simple":return ",";default:return "&"}},F=t=>{switch(t){case "form":return ",";case "pipeDelimited":return "|";case "spaceDelimited":return "%20";default:return ","}},M=t=>{switch(t){case "label":return ".";case "matrix":return ";";case "simple":return ",";default:return "&"}},O=({allowReserved:t,explode:r,name:e,style:o,value:s})=>{if(!r){let n=(t?s:s.map(c=>encodeURIComponent(c))).join(F(o));switch(o){case "label":return `.${n}`;case "matrix":return `;${e}=${n}`;case "simple":return n;default:return `${e}=${n}`}}let a=D(o),i=s.map(n=>o==="label"||o==="simple"?t?n:encodeURIComponent(n):m({allowReserved:t,name:e,value:n})).join(a);return o==="label"||o==="matrix"?a+i:i},m=({allowReserved:t,name:r,value:e})=>{if(e==null)return "";if(typeof e=="object")throw new Error("Deeply-nested arrays/objects aren\u2019t supported. Provide your own `querySerializer()` to handle these.");return `${r}=${t?e:encodeURIComponent(e)}`},R=({allowReserved:t,explode:r,name:e,style:o,value:s,valueOnly:a})=>{if(s instanceof Date)return a?s.toISOString():`${e}=${s.toISOString()}`;if(o!=="deepObject"&&!r){let c=[];Object.entries(s).forEach(([f,d])=>{c=[...c,f,t?d:encodeURIComponent(d)];});let p=c.join(",");switch(o){case "form":return `${e}=${p}`;case "label":return `.${p}`;case "matrix":return `;${e}=${p}`;default:return p}}let i=M(o),n=Object.entries(s).map(([c,p])=>m({allowReserved:t,name:o==="deepObject"?`${e}[${c}]`:c,value:p})).join(i);return o==="label"||o==="matrix"?i+n:n};var H=/\{[^{}]+\}/g,B=({path:t,url:r})=>{let e=r,o=r.match(H);if(o)for(let s of o){let a=false,i=s.substring(1,s.length-1),n="simple";i.endsWith("*")&&(a=true,i=i.substring(0,i.length-1)),i.startsWith(".")?(i=i.substring(1),n="label"):i.startsWith(";")&&(i=i.substring(1),n="matrix");let c=t[i];if(c==null)continue;if(Array.isArray(c)){e=e.replace(s,O({explode:a,name:i,style:n,value:c}));continue}if(typeof c=="object"){e=e.replace(s,R({explode:a,name:i,style:n,value:c,valueOnly:true}));continue}if(n==="matrix"){e=e.replace(s,`;${m({name:i,value:c})}`);continue}let p=encodeURIComponent(n==="label"?`.${c}`:c);e=e.replace(s,p);}return e},k=({allowReserved:t,array:r,object:e}={})=>s=>{let a=[];if(s&&typeof s=="object")for(let i in s){let n=s[i];if(n!=null)if(Array.isArray(n)){let c=O({allowReserved:t,explode:true,name:i,style:"form",value:n,...r});c&&a.push(c);}else if(typeof n=="object"){let c=R({allowReserved:t,explode:true,name:i,style:"deepObject",value:n,...e});c&&a.push(c);}else {let c=m({allowReserved:t,name:i,value:n});c&&a.push(c);}}return a.join("&")},I=t=>{if(!t)return "stream";let r=t.split(";")[0]?.trim();if(r){if(r.startsWith("application/json")||r.endsWith("+json"))return "json";if(r==="multipart/form-data")return "formData";if(["application/","audio/","image/","video/"].some(e=>r.startsWith(e)))return "blob";if(r.startsWith("text/"))return "text"}},W=(t,r)=>r?!!(t.headers.has(r)||t.query?.[r]||t.headers.get("Cookie")?.includes(`${r}=`)):false,T=async({security:t,...r})=>{for(let e of t){if(W(r,e.name))continue;let o=await A(e,r.auth);if(!o)continue;let s=e.name??"Authorization";switch(e.in){case "query":r.query||(r.query={}),r.query[s]=o;break;case "cookie":r.headers.append("Cookie",`${s}=${o}`);break;case "header":default:r.headers.set(s,o);break}}},q=t=>N({baseUrl:t.baseUrl,path:t.path,query:t.query,querySerializer:typeof t.querySerializer=="function"?t.querySerializer:k(t.querySerializer),url:t.url}),N=({baseUrl:t,path:r,query:e,querySerializer:o,url:s})=>{let a=s.startsWith("/")?s:`/${s}`,i=(t??"")+a;r&&(i=B({path:r,url:i}));let n=e?o(e):"";return n.startsWith("?")&&(n=n.substring(1)),n&&(i+=`?${n}`),i},z=(t,r)=>{let e={...t,...r};return e.baseUrl?.endsWith("/")&&(e.baseUrl=e.baseUrl.substring(0,e.baseUrl.length-1)),e.headers=C(t.headers,r.headers),e},C=(...t)=>{let r=new Headers;for(let e of t){if(!e||typeof e!="object")continue;let o=e instanceof Headers?e.entries():Object.entries(e);for(let[s,a]of o)if(a===null)r.delete(s);else if(Array.isArray(a))for(let i of a)r.append(s,i);else a!==void 0&&r.set(s,typeof a=="object"?JSON.stringify(a):a);}return r},g=class{_fns;constructor(){this._fns=[];}clear(){this._fns=[];}getInterceptorIndex(r){return typeof r=="number"?this._fns[r]?r:-1:this._fns.indexOf(r)}exists(r){let e=this.getInterceptorIndex(r);return !!this._fns[e]}eject(r){let e=this.getInterceptorIndex(r);this._fns[e]&&(this._fns[e]=null);}update(r,e){let o=this.getInterceptorIndex(r);return this._fns[o]?(this._fns[o]=e,r):false}use(r){return this._fns=[...this._fns,r],this._fns.length-1}},E=()=>({error:new g,request:new g,response:new g}),Q=k({allowReserved:false,array:{explode:true,style:"form"},object:{explode:true,style:"deepObject"}}),V={"Content-Type":"application/json"},j=(t={})=>({...x,headers:V,parseAs:"auto",querySerializer:Q,...t});var J=(t={})=>{let r=z(j(),t),e=()=>({...r}),o=i=>(r=z(r,i),e()),s=E(),a=async i=>{let n={...r,...i,fetch:i.fetch??r.fetch??globalThis.fetch,headers:C(r.headers,i.headers)};n.security&&await T({...n,security:n.security}),n.body&&n.bodySerializer&&(n.body=n.bodySerializer(n.body)),n.requestValidator&&await n.requestValidator(n),(n.body===void 0||n.body==="")&&n.headers.delete("Content-Type");let c=q(n),p={redirect:"follow",...n},f=new Request(c,p);for(let u of s.request._fns)u&&(f=await u(f,n));let d=n.fetch,l=await d(f);for(let u of s.response._fns)u&&(l=await u(l,f,n));let b={request:f,response:l};if(l.ok){if(l.status===204||l.headers.get("Content-Length")==="0")return {data:{},...b};let u=(n.parseAs==="auto"?I(l.headers.get("Content-Type")):n.parseAs)??"json",h;switch(u){case "arrayBuffer":case "blob":case "formData":case "json":case "text":h=await l[u]();break;case "stream":return {data:l.body,...b}}return u==="json"&&(n.responseValidator&&await n.responseValidator(h),n.responseTransformer&&(h=await n.responseTransformer(h))),{data:h,...b}}let S=await l.text();try{S=JSON.parse(S);}catch{}let y=S;for(let u of s.error._fns)u&&(y=await u(S,l,f,n));if(y=y||{},n.throwOnError)throw y;return {error:y,...b}};return {buildUrl:q,connect:i=>a({...i,method:"CONNECT"}),delete:i=>a({...i,method:"DELETE"}),get:i=>a({...i,method:"GET"}),getConfig:e,head:i=>a({...i,method:"HEAD"}),interceptors:s,options:i=>a({...i,method:"OPTIONS"}),patch:i=>a({...i,method:"PATCH"}),post:i=>a({...i,method:"POST"}),put:i=>a({...i,method:"PUT"}),request:a,setConfig:o,trace:i=>a({...i,method:"TRACE"})}};var K={$body_:"body",$headers_:"headers",$path_:"path",$query_:"query"},L=Object.entries(K),$=(t,r)=>{r||(r=new Map);for(let e of t)"in"in e?e.key&&r.set(e.key,{in:e.in,map:e.map}):e.args&&$(e.args,r);return r},G=t=>{for(let[r,e]of Object.entries(t))e&&typeof e=="object"&&!Object.keys(e).length&&delete t[r];},v=(t,r)=>{let e={body:{},headers:{},path:{},query:{}},o=$(r),s;for(let[a,i]of t.entries())if(r[a]&&(s=r[a]),!!s)if("in"in s)if(s.key){let n=o.get(s.key),c=n.map||s.key;e[n.in][c]=i;}else e.body=i;else for(let[n,c]of Object.entries(i??{})){let p=o.get(n);if(p){let f=p.map||n;e[p.in][f]=c;}else {let f=L.find(([d])=>n.startsWith(d));if(f){let[d,l]=f;e[l][n.slice(d.length)]=c;}else for(let[d,l]of Object.entries(s.allowExtra??{}))if(l){e[d][n]=c;break}}}return G(e),e};exports.buildClientParams=v;exports.createClient=J;exports.createConfig=j;exports.formDataBodySerializer=_;exports.jsonBodySerializer=x;exports.urlSearchParamsBodySerializer=U;//# sourceMappingURL=index.cjs.map //# sourceMappingURL=index.cjs.map \ No newline at end of file diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/content-types/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/content-types/client/client.gen.ts index 06ff1ec77..e3e634266 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/content-types/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/content-types/client/client.gen.ts @@ -55,14 +55,14 @@ export const createClient = (config: Config = {}): Client => { }); } - if (opts.requestValidator) { - await opts.requestValidator(opts); - } - if (opts.body && opts.bodySerializer) { opts.body = opts.bodySerializer(opts.body); } + if (opts.requestValidator) { + await opts.requestValidator(opts); + } + const url = buildUrl(opts); return { opts, url }; diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/headers/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/headers/client/client.gen.ts index f68339318..711020aa6 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/headers/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/headers/client/client.gen.ts @@ -56,14 +56,14 @@ export const createClient = (config: Config = {}): Client => { }); } - if (opts.requestValidator) { - await opts.requestValidator(opts); - } - if (opts.body && opts.bodySerializer) { opts.serializedBody = opts.bodySerializer(opts.body); } + if (opts.requestValidator) { + await opts.requestValidator(opts); + } + // remove Content-Type header if body is empty to avoid sending invalid requests if (opts.serializedBody === undefined || opts.serializedBody === '') { opts.headers.delete('Content-Type'); diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/internal-name-conflict/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/internal-name-conflict/client/client.gen.ts index f68339318..711020aa6 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/internal-name-conflict/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/internal-name-conflict/client/client.gen.ts @@ -56,14 +56,14 @@ export const createClient = (config: Config = {}): Client => { }); } - if (opts.requestValidator) { - await opts.requestValidator(opts); - } - if (opts.body && opts.bodySerializer) { opts.serializedBody = opts.bodySerializer(opts.body); } + if (opts.requestValidator) { + await opts.requestValidator(opts); + } + // remove Content-Type header if body is empty to avoid sending invalid requests if (opts.serializedBody === undefined || opts.serializedBody === '') { opts.headers.delete('Content-Type'); diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/pagination-ref/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/pagination-ref/client/client.gen.ts index f68339318..711020aa6 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/pagination-ref/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/pagination-ref/client/client.gen.ts @@ -56,14 +56,14 @@ export const createClient = (config: Config = {}): Client => { }); } - if (opts.requestValidator) { - await opts.requestValidator(opts); - } - if (opts.body && opts.bodySerializer) { opts.serializedBody = opts.bodySerializer(opts.body); } + if (opts.requestValidator) { + await opts.requestValidator(opts); + } + // remove Content-Type header if body is empty to avoid sending invalid requests if (opts.serializedBody === undefined || opts.serializedBody === '') { opts.headers.delete('Content-Type'); diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/parameter-explode-false-axios/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/parameter-explode-false-axios/client/client.gen.ts index 06ff1ec77..e3e634266 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/parameter-explode-false-axios/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/parameter-explode-false-axios/client/client.gen.ts @@ -55,14 +55,14 @@ export const createClient = (config: Config = {}): Client => { }); } - if (opts.requestValidator) { - await opts.requestValidator(opts); - } - if (opts.body && opts.bodySerializer) { opts.body = opts.bodySerializer(opts.body); } + if (opts.requestValidator) { + await opts.requestValidator(opts); + } + const url = buildUrl(opts); return { opts, url }; diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/parameter-explode-false/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/parameter-explode-false/client/client.gen.ts index f68339318..711020aa6 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/parameter-explode-false/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/parameter-explode-false/client/client.gen.ts @@ -56,14 +56,14 @@ export const createClient = (config: Config = {}): Client => { }); } - if (opts.requestValidator) { - await opts.requestValidator(opts); - } - if (opts.body && opts.bodySerializer) { opts.serializedBody = opts.bodySerializer(opts.body); } + if (opts.requestValidator) { + await opts.requestValidator(opts); + } + // remove Content-Type header if body is empty to avoid sending invalid requests if (opts.serializedBody === undefined || opts.serializedBody === '') { opts.headers.delete('Content-Type'); diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@hey-api/client-fetch/sdk-nested-classes-instance/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@hey-api/client-fetch/sdk-nested-classes-instance/client/client.gen.ts index f68339318..711020aa6 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@hey-api/client-fetch/sdk-nested-classes-instance/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@hey-api/client-fetch/sdk-nested-classes-instance/client/client.gen.ts @@ -56,14 +56,14 @@ export const createClient = (config: Config = {}): Client => { }); } - if (opts.requestValidator) { - await opts.requestValidator(opts); - } - if (opts.body && opts.bodySerializer) { opts.serializedBody = opts.bodySerializer(opts.body); } + if (opts.requestValidator) { + await opts.requestValidator(opts); + } + // remove Content-Type header if body is empty to avoid sending invalid requests if (opts.serializedBody === undefined || opts.serializedBody === '') { opts.headers.delete('Content-Type'); diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@hey-api/client-fetch/sdk-nested-classes/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@hey-api/client-fetch/sdk-nested-classes/client/client.gen.ts index f68339318..711020aa6 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@hey-api/client-fetch/sdk-nested-classes/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@hey-api/client-fetch/sdk-nested-classes/client/client.gen.ts @@ -56,14 +56,14 @@ export const createClient = (config: Config = {}): Client => { }); } - if (opts.requestValidator) { - await opts.requestValidator(opts); - } - if (opts.body && opts.bodySerializer) { opts.serializedBody = opts.bodySerializer(opts.body); } + if (opts.requestValidator) { + await opts.requestValidator(opts); + } + // remove Content-Type header if body is empty to avoid sending invalid requests if (opts.serializedBody === undefined || opts.serializedBody === '') { opts.headers.delete('Content-Type'); diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@hey-api/sdk/default/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@hey-api/sdk/default/client/client.gen.ts index f68339318..711020aa6 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@hey-api/sdk/default/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@hey-api/sdk/default/client/client.gen.ts @@ -56,14 +56,14 @@ export const createClient = (config: Config = {}): Client => { }); } - if (opts.requestValidator) { - await opts.requestValidator(opts); - } - if (opts.body && opts.bodySerializer) { opts.serializedBody = opts.bodySerializer(opts.body); } + if (opts.requestValidator) { + await opts.requestValidator(opts); + } + // remove Content-Type header if body is empty to avoid sending invalid requests if (opts.serializedBody === undefined || opts.serializedBody === '') { opts.headers.delete('Content-Type'); diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@hey-api/sdk/instance/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@hey-api/sdk/instance/client/client.gen.ts index f68339318..711020aa6 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@hey-api/sdk/instance/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@hey-api/sdk/instance/client/client.gen.ts @@ -56,14 +56,14 @@ export const createClient = (config: Config = {}): Client => { }); } - if (opts.requestValidator) { - await opts.requestValidator(opts); - } - if (opts.body && opts.bodySerializer) { opts.serializedBody = opts.bodySerializer(opts.body); } + if (opts.requestValidator) { + await opts.requestValidator(opts); + } + // remove Content-Type header if body is empty to avoid sending invalid requests if (opts.serializedBody === undefined || opts.serializedBody === '') { opts.headers.delete('Content-Type'); diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@hey-api/sdk/throwOnError/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@hey-api/sdk/throwOnError/client/client.gen.ts index f68339318..711020aa6 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@hey-api/sdk/throwOnError/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@hey-api/sdk/throwOnError/client/client.gen.ts @@ -56,14 +56,14 @@ export const createClient = (config: Config = {}): Client => { }); } - if (opts.requestValidator) { - await opts.requestValidator(opts); - } - if (opts.body && opts.bodySerializer) { opts.serializedBody = opts.bodySerializer(opts.body); } + if (opts.requestValidator) { + await opts.requestValidator(opts); + } + // remove Content-Type header if body is empty to avoid sending invalid requests if (opts.serializedBody === undefined || opts.serializedBody === '') { opts.headers.delete('Content-Type'); diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@hey-api/transformers/type-format-valibot/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@hey-api/transformers/type-format-valibot/client/client.gen.ts index f68339318..711020aa6 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@hey-api/transformers/type-format-valibot/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@hey-api/transformers/type-format-valibot/client/client.gen.ts @@ -56,14 +56,14 @@ export const createClient = (config: Config = {}): Client => { }); } - if (opts.requestValidator) { - await opts.requestValidator(opts); - } - if (opts.body && opts.bodySerializer) { opts.serializedBody = opts.bodySerializer(opts.body); } + if (opts.requestValidator) { + await opts.requestValidator(opts); + } + // remove Content-Type header if body is empty to avoid sending invalid requests if (opts.serializedBody === undefined || opts.serializedBody === '') { opts.headers.delete('Content-Type'); diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@hey-api/transformers/type-format-zod/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@hey-api/transformers/type-format-zod/client/client.gen.ts index f68339318..711020aa6 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@hey-api/transformers/type-format-zod/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@hey-api/transformers/type-format-zod/client/client.gen.ts @@ -56,14 +56,14 @@ export const createClient = (config: Config = {}): Client => { }); } - if (opts.requestValidator) { - await opts.requestValidator(opts); - } - if (opts.body && opts.bodySerializer) { opts.serializedBody = opts.bodySerializer(opts.body); } + if (opts.requestValidator) { + await opts.requestValidator(opts); + } + // remove Content-Type header if body is empty to avoid sending invalid requests if (opts.serializedBody === undefined || opts.serializedBody === '') { opts.headers.delete('Content-Type'); diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@hey-api/typescript/transforms-read-write-custom-name/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@hey-api/typescript/transforms-read-write-custom-name/client/client.gen.ts index f68339318..711020aa6 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@hey-api/typescript/transforms-read-write-custom-name/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@hey-api/typescript/transforms-read-write-custom-name/client/client.gen.ts @@ -56,14 +56,14 @@ export const createClient = (config: Config = {}): Client => { }); } - if (opts.requestValidator) { - await opts.requestValidator(opts); - } - if (opts.body && opts.bodySerializer) { opts.serializedBody = opts.bodySerializer(opts.body); } + if (opts.requestValidator) { + await opts.requestValidator(opts); + } + // remove Content-Type header if body is empty to avoid sending invalid requests if (opts.serializedBody === undefined || opts.serializedBody === '') { opts.headers.delete('Content-Type'); diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@hey-api/typescript/transforms-read-write-ignore/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@hey-api/typescript/transforms-read-write-ignore/client/client.gen.ts index f68339318..711020aa6 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@hey-api/typescript/transforms-read-write-ignore/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@hey-api/typescript/transforms-read-write-ignore/client/client.gen.ts @@ -56,14 +56,14 @@ export const createClient = (config: Config = {}): Client => { }); } - if (opts.requestValidator) { - await opts.requestValidator(opts); - } - if (opts.body && opts.bodySerializer) { opts.serializedBody = opts.bodySerializer(opts.body); } + if (opts.requestValidator) { + await opts.requestValidator(opts); + } + // remove Content-Type header if body is empty to avoid sending invalid requests if (opts.serializedBody === undefined || opts.serializedBody === '') { opts.headers.delete('Content-Type'); diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@pinia/colada/fetch/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@pinia/colada/fetch/client/client.gen.ts index f68339318..711020aa6 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@pinia/colada/fetch/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@pinia/colada/fetch/client/client.gen.ts @@ -56,14 +56,14 @@ export const createClient = (config: Config = {}): Client => { }); } - if (opts.requestValidator) { - await opts.requestValidator(opts); - } - if (opts.body && opts.bodySerializer) { opts.serializedBody = opts.bodySerializer(opts.body); } + if (opts.requestValidator) { + await opts.requestValidator(opts); + } + // remove Content-Type header if body is empty to avoid sending invalid requests if (opts.serializedBody === undefined || opts.serializedBody === '') { opts.headers.delete('Content-Type'); diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@pinia/colada/group-by-tag/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@pinia/colada/group-by-tag/client/client.gen.ts index f68339318..711020aa6 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@pinia/colada/group-by-tag/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@pinia/colada/group-by-tag/client/client.gen.ts @@ -56,14 +56,14 @@ export const createClient = (config: Config = {}): Client => { }); } - if (opts.requestValidator) { - await opts.requestValidator(opts); - } - if (opts.body && opts.bodySerializer) { opts.serializedBody = opts.bodySerializer(opts.body); } + if (opts.requestValidator) { + await opts.requestValidator(opts); + } + // remove Content-Type header if body is empty to avoid sending invalid requests if (opts.serializedBody === undefined || opts.serializedBody === '') { opts.headers.delete('Content-Type'); diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/angular-query-experimental/asClass/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/angular-query-experimental/asClass/client/client.gen.ts index f68339318..711020aa6 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/angular-query-experimental/asClass/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/angular-query-experimental/asClass/client/client.gen.ts @@ -56,14 +56,14 @@ export const createClient = (config: Config = {}): Client => { }); } - if (opts.requestValidator) { - await opts.requestValidator(opts); - } - if (opts.body && opts.bodySerializer) { opts.serializedBody = opts.bodySerializer(opts.body); } + if (opts.requestValidator) { + await opts.requestValidator(opts); + } + // remove Content-Type header if body is empty to avoid sending invalid requests if (opts.serializedBody === undefined || opts.serializedBody === '') { opts.headers.delete('Content-Type'); diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/angular-query-experimental/axios/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/angular-query-experimental/axios/client/client.gen.ts index 06ff1ec77..e3e634266 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/angular-query-experimental/axios/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/angular-query-experimental/axios/client/client.gen.ts @@ -55,14 +55,14 @@ export const createClient = (config: Config = {}): Client => { }); } - if (opts.requestValidator) { - await opts.requestValidator(opts); - } - if (opts.body && opts.bodySerializer) { opts.body = opts.bodySerializer(opts.body); } + if (opts.requestValidator) { + await opts.requestValidator(opts); + } + const url = buildUrl(opts); return { opts, url }; diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/angular-query-experimental/fetch/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/angular-query-experimental/fetch/client/client.gen.ts index f68339318..711020aa6 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/angular-query-experimental/fetch/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/angular-query-experimental/fetch/client/client.gen.ts @@ -56,14 +56,14 @@ export const createClient = (config: Config = {}): Client => { }); } - if (opts.requestValidator) { - await opts.requestValidator(opts); - } - if (opts.body && opts.bodySerializer) { opts.serializedBody = opts.bodySerializer(opts.body); } + if (opts.requestValidator) { + await opts.requestValidator(opts); + } + // remove Content-Type header if body is empty to avoid sending invalid requests if (opts.serializedBody === undefined || opts.serializedBody === '') { opts.headers.delete('Content-Type'); diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/angular-query-experimental/name-builder/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/angular-query-experimental/name-builder/client/client.gen.ts index f68339318..711020aa6 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/angular-query-experimental/name-builder/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/angular-query-experimental/name-builder/client/client.gen.ts @@ -56,14 +56,14 @@ export const createClient = (config: Config = {}): Client => { }); } - if (opts.requestValidator) { - await opts.requestValidator(opts); - } - if (opts.body && opts.bodySerializer) { opts.serializedBody = opts.bodySerializer(opts.body); } + if (opts.requestValidator) { + await opts.requestValidator(opts); + } + // remove Content-Type header if body is empty to avoid sending invalid requests if (opts.serializedBody === undefined || opts.serializedBody === '') { opts.headers.delete('Content-Type'); diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/react-query/asClass/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/react-query/asClass/client/client.gen.ts index f68339318..711020aa6 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/react-query/asClass/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/react-query/asClass/client/client.gen.ts @@ -56,14 +56,14 @@ export const createClient = (config: Config = {}): Client => { }); } - if (opts.requestValidator) { - await opts.requestValidator(opts); - } - if (opts.body && opts.bodySerializer) { opts.serializedBody = opts.bodySerializer(opts.body); } + if (opts.requestValidator) { + await opts.requestValidator(opts); + } + // remove Content-Type header if body is empty to avoid sending invalid requests if (opts.serializedBody === undefined || opts.serializedBody === '') { opts.headers.delete('Content-Type'); diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/react-query/axios/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/react-query/axios/client/client.gen.ts index 06ff1ec77..e3e634266 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/react-query/axios/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/react-query/axios/client/client.gen.ts @@ -55,14 +55,14 @@ export const createClient = (config: Config = {}): Client => { }); } - if (opts.requestValidator) { - await opts.requestValidator(opts); - } - if (opts.body && opts.bodySerializer) { opts.body = opts.bodySerializer(opts.body); } + if (opts.requestValidator) { + await opts.requestValidator(opts); + } + const url = buildUrl(opts); return { opts, url }; diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/react-query/fetch/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/react-query/fetch/client/client.gen.ts index f68339318..711020aa6 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/react-query/fetch/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/react-query/fetch/client/client.gen.ts @@ -56,14 +56,14 @@ export const createClient = (config: Config = {}): Client => { }); } - if (opts.requestValidator) { - await opts.requestValidator(opts); - } - if (opts.body && opts.bodySerializer) { opts.serializedBody = opts.bodySerializer(opts.body); } + if (opts.requestValidator) { + await opts.requestValidator(opts); + } + // remove Content-Type header if body is empty to avoid sending invalid requests if (opts.serializedBody === undefined || opts.serializedBody === '') { opts.headers.delete('Content-Type'); diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/react-query/name-builder/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/react-query/name-builder/client/client.gen.ts index f68339318..711020aa6 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/react-query/name-builder/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/react-query/name-builder/client/client.gen.ts @@ -56,14 +56,14 @@ export const createClient = (config: Config = {}): Client => { }); } - if (opts.requestValidator) { - await opts.requestValidator(opts); - } - if (opts.body && opts.bodySerializer) { opts.serializedBody = opts.bodySerializer(opts.body); } + if (opts.requestValidator) { + await opts.requestValidator(opts); + } + // remove Content-Type header if body is empty to avoid sending invalid requests if (opts.serializedBody === undefined || opts.serializedBody === '') { opts.headers.delete('Content-Type'); diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/solid-query/asClass/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/solid-query/asClass/client/client.gen.ts index f68339318..711020aa6 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/solid-query/asClass/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/solid-query/asClass/client/client.gen.ts @@ -56,14 +56,14 @@ export const createClient = (config: Config = {}): Client => { }); } - if (opts.requestValidator) { - await opts.requestValidator(opts); - } - if (opts.body && opts.bodySerializer) { opts.serializedBody = opts.bodySerializer(opts.body); } + if (opts.requestValidator) { + await opts.requestValidator(opts); + } + // remove Content-Type header if body is empty to avoid sending invalid requests if (opts.serializedBody === undefined || opts.serializedBody === '') { opts.headers.delete('Content-Type'); diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/solid-query/axios/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/solid-query/axios/client/client.gen.ts index 06ff1ec77..e3e634266 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/solid-query/axios/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/solid-query/axios/client/client.gen.ts @@ -55,14 +55,14 @@ export const createClient = (config: Config = {}): Client => { }); } - if (opts.requestValidator) { - await opts.requestValidator(opts); - } - if (opts.body && opts.bodySerializer) { opts.body = opts.bodySerializer(opts.body); } + if (opts.requestValidator) { + await opts.requestValidator(opts); + } + const url = buildUrl(opts); return { opts, url }; diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/solid-query/fetch/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/solid-query/fetch/client/client.gen.ts index f68339318..711020aa6 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/solid-query/fetch/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/solid-query/fetch/client/client.gen.ts @@ -56,14 +56,14 @@ export const createClient = (config: Config = {}): Client => { }); } - if (opts.requestValidator) { - await opts.requestValidator(opts); - } - if (opts.body && opts.bodySerializer) { opts.serializedBody = opts.bodySerializer(opts.body); } + if (opts.requestValidator) { + await opts.requestValidator(opts); + } + // remove Content-Type header if body is empty to avoid sending invalid requests if (opts.serializedBody === undefined || opts.serializedBody === '') { opts.headers.delete('Content-Type'); diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/solid-query/name-builder/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/solid-query/name-builder/client/client.gen.ts index f68339318..711020aa6 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/solid-query/name-builder/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/solid-query/name-builder/client/client.gen.ts @@ -56,14 +56,14 @@ export const createClient = (config: Config = {}): Client => { }); } - if (opts.requestValidator) { - await opts.requestValidator(opts); - } - if (opts.body && opts.bodySerializer) { opts.serializedBody = opts.bodySerializer(opts.body); } + if (opts.requestValidator) { + await opts.requestValidator(opts); + } + // remove Content-Type header if body is empty to avoid sending invalid requests if (opts.serializedBody === undefined || opts.serializedBody === '') { opts.headers.delete('Content-Type'); diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/svelte-query/asClass/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/svelte-query/asClass/client/client.gen.ts index f68339318..711020aa6 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/svelte-query/asClass/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/svelte-query/asClass/client/client.gen.ts @@ -56,14 +56,14 @@ export const createClient = (config: Config = {}): Client => { }); } - if (opts.requestValidator) { - await opts.requestValidator(opts); - } - if (opts.body && opts.bodySerializer) { opts.serializedBody = opts.bodySerializer(opts.body); } + if (opts.requestValidator) { + await opts.requestValidator(opts); + } + // remove Content-Type header if body is empty to avoid sending invalid requests if (opts.serializedBody === undefined || opts.serializedBody === '') { opts.headers.delete('Content-Type'); diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/svelte-query/axios/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/svelte-query/axios/client/client.gen.ts index 06ff1ec77..e3e634266 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/svelte-query/axios/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/svelte-query/axios/client/client.gen.ts @@ -55,14 +55,14 @@ export const createClient = (config: Config = {}): Client => { }); } - if (opts.requestValidator) { - await opts.requestValidator(opts); - } - if (opts.body && opts.bodySerializer) { opts.body = opts.bodySerializer(opts.body); } + if (opts.requestValidator) { + await opts.requestValidator(opts); + } + const url = buildUrl(opts); return { opts, url }; diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/svelte-query/fetch/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/svelte-query/fetch/client/client.gen.ts index f68339318..711020aa6 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/svelte-query/fetch/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/svelte-query/fetch/client/client.gen.ts @@ -56,14 +56,14 @@ export const createClient = (config: Config = {}): Client => { }); } - if (opts.requestValidator) { - await opts.requestValidator(opts); - } - if (opts.body && opts.bodySerializer) { opts.serializedBody = opts.bodySerializer(opts.body); } + if (opts.requestValidator) { + await opts.requestValidator(opts); + } + // remove Content-Type header if body is empty to avoid sending invalid requests if (opts.serializedBody === undefined || opts.serializedBody === '') { opts.headers.delete('Content-Type'); diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/svelte-query/name-builder/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/svelte-query/name-builder/client/client.gen.ts index f68339318..711020aa6 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/svelte-query/name-builder/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/svelte-query/name-builder/client/client.gen.ts @@ -56,14 +56,14 @@ export const createClient = (config: Config = {}): Client => { }); } - if (opts.requestValidator) { - await opts.requestValidator(opts); - } - if (opts.body && opts.bodySerializer) { opts.serializedBody = opts.bodySerializer(opts.body); } + if (opts.requestValidator) { + await opts.requestValidator(opts); + } + // remove Content-Type header if body is empty to avoid sending invalid requests if (opts.serializedBody === undefined || opts.serializedBody === '') { opts.headers.delete('Content-Type'); diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/vue-query/asClass/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/vue-query/asClass/client/client.gen.ts index f68339318..711020aa6 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/vue-query/asClass/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/vue-query/asClass/client/client.gen.ts @@ -56,14 +56,14 @@ export const createClient = (config: Config = {}): Client => { }); } - if (opts.requestValidator) { - await opts.requestValidator(opts); - } - if (opts.body && opts.bodySerializer) { opts.serializedBody = opts.bodySerializer(opts.body); } + if (opts.requestValidator) { + await opts.requestValidator(opts); + } + // remove Content-Type header if body is empty to avoid sending invalid requests if (opts.serializedBody === undefined || opts.serializedBody === '') { opts.headers.delete('Content-Type'); diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/vue-query/axios/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/vue-query/axios/client/client.gen.ts index 06ff1ec77..e3e634266 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/vue-query/axios/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/vue-query/axios/client/client.gen.ts @@ -55,14 +55,14 @@ export const createClient = (config: Config = {}): Client => { }); } - if (opts.requestValidator) { - await opts.requestValidator(opts); - } - if (opts.body && opts.bodySerializer) { opts.body = opts.bodySerializer(opts.body); } + if (opts.requestValidator) { + await opts.requestValidator(opts); + } + const url = buildUrl(opts); return { opts, url }; diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/vue-query/fetch/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/vue-query/fetch/client/client.gen.ts index f68339318..711020aa6 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/vue-query/fetch/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/vue-query/fetch/client/client.gen.ts @@ -56,14 +56,14 @@ export const createClient = (config: Config = {}): Client => { }); } - if (opts.requestValidator) { - await opts.requestValidator(opts); - } - if (opts.body && opts.bodySerializer) { opts.serializedBody = opts.bodySerializer(opts.body); } + if (opts.requestValidator) { + await opts.requestValidator(opts); + } + // remove Content-Type header if body is empty to avoid sending invalid requests if (opts.serializedBody === undefined || opts.serializedBody === '') { opts.headers.delete('Content-Type'); diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/vue-query/name-builder/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/vue-query/name-builder/client/client.gen.ts index f68339318..711020aa6 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/vue-query/name-builder/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/vue-query/name-builder/client/client.gen.ts @@ -56,14 +56,14 @@ export const createClient = (config: Config = {}): Client => { }); } - if (opts.requestValidator) { - await opts.requestValidator(opts); - } - if (opts.body && opts.bodySerializer) { opts.serializedBody = opts.bodySerializer(opts.body); } + if (opts.requestValidator) { + await opts.requestValidator(opts); + } + // remove Content-Type header if body is empty to avoid sending invalid requests if (opts.serializedBody === undefined || opts.serializedBody === '') { opts.headers.delete('Content-Type'); diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/security-api-key/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/security-api-key/client/client.gen.ts index f68339318..711020aa6 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/security-api-key/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/security-api-key/client/client.gen.ts @@ -56,14 +56,14 @@ export const createClient = (config: Config = {}): Client => { }); } - if (opts.requestValidator) { - await opts.requestValidator(opts); - } - if (opts.body && opts.bodySerializer) { opts.serializedBody = opts.bodySerializer(opts.body); } + if (opts.requestValidator) { + await opts.requestValidator(opts); + } + // remove Content-Type header if body is empty to avoid sending invalid requests if (opts.serializedBody === undefined || opts.serializedBody === '') { opts.headers.delete('Content-Type'); diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/security-false/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/security-false/client/client.gen.ts index f68339318..711020aa6 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/security-false/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/security-false/client/client.gen.ts @@ -56,14 +56,14 @@ export const createClient = (config: Config = {}): Client => { }); } - if (opts.requestValidator) { - await opts.requestValidator(opts); - } - if (opts.body && opts.bodySerializer) { opts.serializedBody = opts.bodySerializer(opts.body); } + if (opts.requestValidator) { + await opts.requestValidator(opts); + } + // remove Content-Type header if body is empty to avoid sending invalid requests if (opts.serializedBody === undefined || opts.serializedBody === '') { opts.headers.delete('Content-Type'); diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/security-http-bearer/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/security-http-bearer/client/client.gen.ts index f68339318..711020aa6 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/security-http-bearer/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/security-http-bearer/client/client.gen.ts @@ -56,14 +56,14 @@ export const createClient = (config: Config = {}): Client => { }); } - if (opts.requestValidator) { - await opts.requestValidator(opts); - } - if (opts.body && opts.bodySerializer) { opts.serializedBody = opts.bodySerializer(opts.body); } + if (opts.requestValidator) { + await opts.requestValidator(opts); + } + // remove Content-Type header if body is empty to avoid sending invalid requests if (opts.serializedBody === undefined || opts.serializedBody === '') { opts.headers.delete('Content-Type'); diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/security-oauth2/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/security-oauth2/client/client.gen.ts index f68339318..711020aa6 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/security-oauth2/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/security-oauth2/client/client.gen.ts @@ -56,14 +56,14 @@ export const createClient = (config: Config = {}): Client => { }); } - if (opts.requestValidator) { - await opts.requestValidator(opts); - } - if (opts.body && opts.bodySerializer) { opts.serializedBody = opts.bodySerializer(opts.body); } + if (opts.requestValidator) { + await opts.requestValidator(opts); + } + // remove Content-Type header if body is empty to avoid sending invalid requests if (opts.serializedBody === undefined || opts.serializedBody === '') { opts.headers.delete('Content-Type'); diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/security-open-id-connect/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/security-open-id-connect/client/client.gen.ts index f68339318..711020aa6 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/security-open-id-connect/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/security-open-id-connect/client/client.gen.ts @@ -56,14 +56,14 @@ export const createClient = (config: Config = {}): Client => { }); } - if (opts.requestValidator) { - await opts.requestValidator(opts); - } - if (opts.body && opts.bodySerializer) { opts.serializedBody = opts.bodySerializer(opts.body); } + if (opts.requestValidator) { + await opts.requestValidator(opts); + } + // remove Content-Type header if body is empty to avoid sending invalid requests if (opts.serializedBody === undefined || opts.serializedBody === '') { opts.headers.delete('Content-Type'); diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/servers/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/servers/client/client.gen.ts index f68339318..711020aa6 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/servers/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/servers/client/client.gen.ts @@ -56,14 +56,14 @@ export const createClient = (config: Config = {}): Client => { }); } - if (opts.requestValidator) { - await opts.requestValidator(opts); - } - if (opts.body && opts.bodySerializer) { opts.serializedBody = opts.bodySerializer(opts.body); } + if (opts.requestValidator) { + await opts.requestValidator(opts); + } + // remove Content-Type header if body is empty to avoid sending invalid requests if (opts.serializedBody === undefined || opts.serializedBody === '') { opts.headers.delete('Content-Type'); diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/sse-axios/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/sse-axios/client/client.gen.ts index 06ff1ec77..e3e634266 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/sse-axios/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/sse-axios/client/client.gen.ts @@ -55,14 +55,14 @@ export const createClient = (config: Config = {}): Client => { }); } - if (opts.requestValidator) { - await opts.requestValidator(opts); - } - if (opts.body && opts.bodySerializer) { opts.body = opts.bodySerializer(opts.body); } + if (opts.requestValidator) { + await opts.requestValidator(opts); + } + const url = buildUrl(opts); return { opts, url }; diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/sse-fetch/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/sse-fetch/client/client.gen.ts index f68339318..711020aa6 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/sse-fetch/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/sse-fetch/client/client.gen.ts @@ -56,14 +56,14 @@ export const createClient = (config: Config = {}): Client => { }); } - if (opts.requestValidator) { - await opts.requestValidator(opts); - } - if (opts.body && opts.bodySerializer) { opts.serializedBody = opts.bodySerializer(opts.body); } + if (opts.requestValidator) { + await opts.requestValidator(opts); + } + // remove Content-Type header if body is empty to avoid sending invalid requests if (opts.serializedBody === undefined || opts.serializedBody === '') { opts.headers.delete('Content-Type'); diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/sse-next/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/sse-next/client/client.gen.ts index 9a3f20891..3d484fd53 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/sse-next/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/sse-next/client/client.gen.ts @@ -55,14 +55,14 @@ export const createClient = (config: Config = {}): Client => { }); } - if (opts.requestValidator) { - await opts.requestValidator(opts); - } - if (opts.body && opts.bodySerializer) { opts.serializedBody = opts.bodySerializer(opts.body); } + if (opts.requestValidator) { + await opts.requestValidator(opts); + } + // remove Content-Type header if body is empty to avoid sending invalid requests if (opts.serializedBody === undefined || opts.serializedBody === '') { opts.headers.delete('Content-Type'); diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/transformers-all-of/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/transformers-all-of/client/client.gen.ts index f68339318..711020aa6 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/transformers-all-of/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/transformers-all-of/client/client.gen.ts @@ -56,14 +56,14 @@ export const createClient = (config: Config = {}): Client => { }); } - if (opts.requestValidator) { - await opts.requestValidator(opts); - } - if (opts.body && opts.bodySerializer) { opts.serializedBody = opts.bodySerializer(opts.body); } + if (opts.requestValidator) { + await opts.requestValidator(opts); + } + // remove Content-Type header if body is empty to avoid sending invalid requests if (opts.serializedBody === undefined || opts.serializedBody === '') { opts.headers.delete('Content-Type'); diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/transformers-any-of-null/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/transformers-any-of-null/client/client.gen.ts index f68339318..711020aa6 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/transformers-any-of-null/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/transformers-any-of-null/client/client.gen.ts @@ -56,14 +56,14 @@ export const createClient = (config: Config = {}): Client => { }); } - if (opts.requestValidator) { - await opts.requestValidator(opts); - } - if (opts.body && opts.bodySerializer) { opts.serializedBody = opts.bodySerializer(opts.body); } + if (opts.requestValidator) { + await opts.requestValidator(opts); + } + // remove Content-Type header if body is empty to avoid sending invalid requests if (opts.serializedBody === undefined || opts.serializedBody === '') { opts.headers.delete('Content-Type'); diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/transformers-array/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/transformers-array/client/client.gen.ts index f68339318..711020aa6 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/transformers-array/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/transformers-array/client/client.gen.ts @@ -56,14 +56,14 @@ export const createClient = (config: Config = {}): Client => { }); } - if (opts.requestValidator) { - await opts.requestValidator(opts); - } - if (opts.body && opts.bodySerializer) { opts.serializedBody = opts.bodySerializer(opts.body); } + if (opts.requestValidator) { + await opts.requestValidator(opts); + } + // remove Content-Type header if body is empty to avoid sending invalid requests if (opts.serializedBody === undefined || opts.serializedBody === '') { opts.headers.delete('Content-Type'); diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/transforms-read-write/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/transforms-read-write/client/client.gen.ts index f68339318..711020aa6 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/transforms-read-write/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/transforms-read-write/client/client.gen.ts @@ -56,14 +56,14 @@ export const createClient = (config: Config = {}): Client => { }); } - if (opts.requestValidator) { - await opts.requestValidator(opts); - } - if (opts.body && opts.bodySerializer) { opts.serializedBody = opts.bodySerializer(opts.body); } + if (opts.requestValidator) { + await opts.requestValidator(opts); + } + // remove Content-Type header if body is empty to avoid sending invalid requests if (opts.serializedBody === undefined || opts.serializedBody === '') { opts.headers.delete('Content-Type'); diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/plugins/@tanstack/meta/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/plugins/@tanstack/meta/client/client.gen.ts index f68339318..711020aa6 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/plugins/@tanstack/meta/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/plugins/@tanstack/meta/client/client.gen.ts @@ -56,14 +56,14 @@ export const createClient = (config: Config = {}): Client => { }); } - if (opts.requestValidator) { - await opts.requestValidator(opts); - } - if (opts.body && opts.bodySerializer) { opts.serializedBody = opts.bodySerializer(opts.body); } + if (opts.requestValidator) { + await opts.requestValidator(opts); + } + // remove Content-Type header if body is empty to avoid sending invalid requests if (opts.serializedBody === undefined || opts.serializedBody === '') { opts.headers.delete('Content-Type'); diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/test/generated/v3_no_index/client/client.gen.ts.snap b/packages/openapi-ts-tests/main/test/__snapshots__/test/generated/v3_no_index/client/client.gen.ts.snap index f68339318..711020aa6 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/test/generated/v3_no_index/client/client.gen.ts.snap +++ b/packages/openapi-ts-tests/main/test/__snapshots__/test/generated/v3_no_index/client/client.gen.ts.snap @@ -56,14 +56,14 @@ export const createClient = (config: Config = {}): Client => { }); } - if (opts.requestValidator) { - await opts.requestValidator(opts); - } - if (opts.body && opts.bodySerializer) { opts.serializedBody = opts.bodySerializer(opts.body); } + if (opts.requestValidator) { + await opts.requestValidator(opts); + } + // remove Content-Type header if body is empty to avoid sending invalid requests if (opts.serializedBody === undefined || opts.serializedBody === '') { opts.headers.delete('Content-Type'); diff --git a/packages/openapi-ts/src/plugins/@hey-api/client-axios/bundle/client.ts b/packages/openapi-ts/src/plugins/@hey-api/client-axios/bundle/client.ts index 4d7b12159..ede95e64a 100644 --- a/packages/openapi-ts/src/plugins/@hey-api/client-axios/bundle/client.ts +++ b/packages/openapi-ts/src/plugins/@hey-api/client-axios/bundle/client.ts @@ -53,14 +53,14 @@ export const createClient = (config: Config = {}): Client => { }); } - if (opts.requestValidator) { - await opts.requestValidator(opts); - } - if (opts.body && opts.bodySerializer) { opts.body = opts.bodySerializer(opts.body); } + if (opts.requestValidator) { + await opts.requestValidator(opts); + } + const url = buildUrl(opts); return { opts, 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 3615a16ac..beee32df6 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 @@ -54,14 +54,14 @@ export const createClient = (config: Config = {}): Client => { }); } - if (opts.requestValidator) { - await opts.requestValidator(opts); - } - if (opts.body && opts.bodySerializer) { opts.serializedBody = opts.bodySerializer(opts.body); } + if (opts.requestValidator) { + await opts.requestValidator(opts); + } + // remove Content-Type header if body is empty to avoid sending invalid requests if (opts.serializedBody === undefined || opts.serializedBody === '') { opts.headers.delete('Content-Type'); 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 f59fe1934..a008a0447 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 @@ -53,14 +53,14 @@ export const createClient = (config: Config = {}): Client => { }); } - if (opts.requestValidator) { - await opts.requestValidator(opts); - } - if (opts.body && opts.bodySerializer) { opts.serializedBody = opts.bodySerializer(opts.body); } + if (opts.requestValidator) { + await opts.requestValidator(opts); + } + // remove Content-Type header if body is empty to avoid sending invalid requests if (opts.serializedBody === undefined || opts.serializedBody === '') { opts.headers.delete('Content-Type');