From 1a6aa67a9e5a4f7bf2d55b3eabfe2588e0c5502f Mon Sep 17 00:00:00 2001 From: tomasvrbka Date: Fri, 9 Aug 2024 13:51:54 +0200 Subject: [PATCH] fix authorization header in form data request --- apps/cli/src/lib/renderers/InfrastructureTemplates.ts | 4 ++-- apps/cli/src/tests/__snapshots__/generate_all_of_reference.ts | 4 ++-- .../tests/__snapshots__/generate_all_of_reference_cookies.ts | 4 ++-- .../tests/__snapshots__/generate_allof_anonymous_schema.ts | 4 ++-- .../__snapshots__/generate_allof_anonymous_schema_cookies.ts | 4 ++-- apps/cli/src/tests/__snapshots__/generate_anonymous_object.ts | 4 ++-- .../tests/__snapshots__/generate_anonymous_object_cookies.ts | 4 ++-- apps/cli/src/tests/__snapshots__/generate_auth_login.ts | 4 ++-- .../src/tests/__snapshots__/generate_auth_login_cookies.ts | 4 ++-- apps/cli/src/tests/__snapshots__/generate_bracket_params.ts | 4 ++-- .../tests/__snapshots__/generate_bracket_params_cookies.ts | 4 ++-- .../tests/__snapshots__/generate_common_prefix_countryCode.ts | 4 ++-- .../generate_common_prefix_countryCode_cookies.ts | 4 ++-- apps/cli/src/tests/__snapshots__/generate_common_prefix_v1.ts | 4 ++-- .../tests/__snapshots__/generate_common_prefix_v1_cookies.ts | 4 ++-- apps/cli/src/tests/__snapshots__/generate_common_prefix_v2.ts | 4 ++-- .../tests/__snapshots__/generate_common_prefix_v2_cookies.ts | 4 ++-- .../src/tests/__snapshots__/generate_multipart_formdata.ts | 4 ++-- .../__snapshots__/generate_multipart_formdata_cookies.ts | 4 ++-- .../generate_multipart_formdata_multiplefiles.ts | 4 ++-- .../generate_multipart_formdata_multiplefiles_cookies.ts | 4 ++-- apps/cli/src/tests/__snapshots__/generate_nswag.ts | 4 ++-- apps/cli/src/tests/__snapshots__/generate_nswag_cookies.ts | 4 ++-- apps/cli/src/tests/__snapshots__/generate_one_of.ts | 4 ++-- apps/cli/src/tests/__snapshots__/generate_one_of_cookies.ts | 4 ++-- apps/cli/src/tests/__snapshots__/generate_petstore.ts | 4 ++-- apps/cli/src/tests/__snapshots__/generate_petstore_cookies.ts | 4 ++-- apps/cli/src/tests/__snapshots__/generate_post_put_bodies.ts | 4 ++-- .../tests/__snapshots__/generate_post_put_bodies_cookies.ts | 4 ++-- apps/cli/src/tests/__snapshots__/generate_swagger_2_0.ts | 4 ++-- .../src/tests/__snapshots__/generate_swagger_2_0_cookies.ts | 4 ++-- 31 files changed, 62 insertions(+), 62 deletions(-) diff --git a/apps/cli/src/lib/renderers/InfrastructureTemplates.ts b/apps/cli/src/lib/renderers/InfrastructureTemplates.ts index f630233..2d4682f 100644 --- a/apps/cli/src/lib/renderers/InfrastructureTemplates.ts +++ b/apps/cli/src/lib/renderers/InfrastructureTemplates.ts @@ -258,11 +258,11 @@ export const getInfrastructureTemplate = (isCookiesAuthEnabled: boolean) => { request: TRequest, headers: Headers ) { + updateHeaders(headers); if (request instanceof FormData) { headers.delete("Content-Type"); return request; - } else { - updateHeaders(headers); + } else { return JSON.stringify(request); } } diff --git a/apps/cli/src/tests/__snapshots__/generate_all_of_reference.ts b/apps/cli/src/tests/__snapshots__/generate_all_of_reference.ts index 2dece47..9f10976 100644 --- a/apps/cli/src/tests/__snapshots__/generate_all_of_reference.ts +++ b/apps/cli/src/tests/__snapshots__/generate_all_of_reference.ts @@ -250,11 +250,11 @@ request: TRequest, headers: Headers ) { + updateHeaders(headers); if (request instanceof FormData) { headers.delete("Content-Type"); return request; - } else { - updateHeaders(headers); + } else { return JSON.stringify(request); } } diff --git a/apps/cli/src/tests/__snapshots__/generate_all_of_reference_cookies.ts b/apps/cli/src/tests/__snapshots__/generate_all_of_reference_cookies.ts index cb3b542..cddc89e 100644 --- a/apps/cli/src/tests/__snapshots__/generate_all_of_reference_cookies.ts +++ b/apps/cli/src/tests/__snapshots__/generate_all_of_reference_cookies.ts @@ -251,11 +251,11 @@ request: TRequest, headers: Headers ) { + updateHeaders(headers); if (request instanceof FormData) { headers.delete("Content-Type"); return request; - } else { - updateHeaders(headers); + } else { return JSON.stringify(request); } } diff --git a/apps/cli/src/tests/__snapshots__/generate_allof_anonymous_schema.ts b/apps/cli/src/tests/__snapshots__/generate_allof_anonymous_schema.ts index 3157a8f..b54278e 100644 --- a/apps/cli/src/tests/__snapshots__/generate_allof_anonymous_schema.ts +++ b/apps/cli/src/tests/__snapshots__/generate_allof_anonymous_schema.ts @@ -250,11 +250,11 @@ request: TRequest, headers: Headers ) { + updateHeaders(headers); if (request instanceof FormData) { headers.delete("Content-Type"); return request; - } else { - updateHeaders(headers); + } else { return JSON.stringify(request); } } diff --git a/apps/cli/src/tests/__snapshots__/generate_allof_anonymous_schema_cookies.ts b/apps/cli/src/tests/__snapshots__/generate_allof_anonymous_schema_cookies.ts index e9eaf40..ab69fa4 100644 --- a/apps/cli/src/tests/__snapshots__/generate_allof_anonymous_schema_cookies.ts +++ b/apps/cli/src/tests/__snapshots__/generate_allof_anonymous_schema_cookies.ts @@ -251,11 +251,11 @@ request: TRequest, headers: Headers ) { + updateHeaders(headers); if (request instanceof FormData) { headers.delete("Content-Type"); return request; - } else { - updateHeaders(headers); + } else { return JSON.stringify(request); } } diff --git a/apps/cli/src/tests/__snapshots__/generate_anonymous_object.ts b/apps/cli/src/tests/__snapshots__/generate_anonymous_object.ts index 64df428..45cb66e 100644 --- a/apps/cli/src/tests/__snapshots__/generate_anonymous_object.ts +++ b/apps/cli/src/tests/__snapshots__/generate_anonymous_object.ts @@ -250,11 +250,11 @@ request: TRequest, headers: Headers ) { + updateHeaders(headers); if (request instanceof FormData) { headers.delete("Content-Type"); return request; - } else { - updateHeaders(headers); + } else { return JSON.stringify(request); } } diff --git a/apps/cli/src/tests/__snapshots__/generate_anonymous_object_cookies.ts b/apps/cli/src/tests/__snapshots__/generate_anonymous_object_cookies.ts index 780fbca..e66bd11 100644 --- a/apps/cli/src/tests/__snapshots__/generate_anonymous_object_cookies.ts +++ b/apps/cli/src/tests/__snapshots__/generate_anonymous_object_cookies.ts @@ -251,11 +251,11 @@ request: TRequest, headers: Headers ) { + updateHeaders(headers); if (request instanceof FormData) { headers.delete("Content-Type"); return request; - } else { - updateHeaders(headers); + } else { return JSON.stringify(request); } } diff --git a/apps/cli/src/tests/__snapshots__/generate_auth_login.ts b/apps/cli/src/tests/__snapshots__/generate_auth_login.ts index b9894bc..16dac93 100644 --- a/apps/cli/src/tests/__snapshots__/generate_auth_login.ts +++ b/apps/cli/src/tests/__snapshots__/generate_auth_login.ts @@ -250,11 +250,11 @@ request: TRequest, headers: Headers ) { + updateHeaders(headers); if (request instanceof FormData) { headers.delete("Content-Type"); return request; - } else { - updateHeaders(headers); + } else { return JSON.stringify(request); } } diff --git a/apps/cli/src/tests/__snapshots__/generate_auth_login_cookies.ts b/apps/cli/src/tests/__snapshots__/generate_auth_login_cookies.ts index 0129db8..8309ec2 100644 --- a/apps/cli/src/tests/__snapshots__/generate_auth_login_cookies.ts +++ b/apps/cli/src/tests/__snapshots__/generate_auth_login_cookies.ts @@ -251,11 +251,11 @@ request: TRequest, headers: Headers ) { + updateHeaders(headers); if (request instanceof FormData) { headers.delete("Content-Type"); return request; - } else { - updateHeaders(headers); + } else { return JSON.stringify(request); } } diff --git a/apps/cli/src/tests/__snapshots__/generate_bracket_params.ts b/apps/cli/src/tests/__snapshots__/generate_bracket_params.ts index 100ef6a..e647beb 100644 --- a/apps/cli/src/tests/__snapshots__/generate_bracket_params.ts +++ b/apps/cli/src/tests/__snapshots__/generate_bracket_params.ts @@ -250,11 +250,11 @@ request: TRequest, headers: Headers ) { + updateHeaders(headers); if (request instanceof FormData) { headers.delete("Content-Type"); return request; - } else { - updateHeaders(headers); + } else { return JSON.stringify(request); } } diff --git a/apps/cli/src/tests/__snapshots__/generate_bracket_params_cookies.ts b/apps/cli/src/tests/__snapshots__/generate_bracket_params_cookies.ts index de50927..448d2ff 100644 --- a/apps/cli/src/tests/__snapshots__/generate_bracket_params_cookies.ts +++ b/apps/cli/src/tests/__snapshots__/generate_bracket_params_cookies.ts @@ -251,11 +251,11 @@ request: TRequest, headers: Headers ) { + updateHeaders(headers); if (request instanceof FormData) { headers.delete("Content-Type"); return request; - } else { - updateHeaders(headers); + } else { return JSON.stringify(request); } } diff --git a/apps/cli/src/tests/__snapshots__/generate_common_prefix_countryCode.ts b/apps/cli/src/tests/__snapshots__/generate_common_prefix_countryCode.ts index c78bf77..a5a481e 100644 --- a/apps/cli/src/tests/__snapshots__/generate_common_prefix_countryCode.ts +++ b/apps/cli/src/tests/__snapshots__/generate_common_prefix_countryCode.ts @@ -250,11 +250,11 @@ request: TRequest, headers: Headers ) { + updateHeaders(headers); if (request instanceof FormData) { headers.delete("Content-Type"); return request; - } else { - updateHeaders(headers); + } else { return JSON.stringify(request); } } diff --git a/apps/cli/src/tests/__snapshots__/generate_common_prefix_countryCode_cookies.ts b/apps/cli/src/tests/__snapshots__/generate_common_prefix_countryCode_cookies.ts index 1ff6d74..0a0f356 100644 --- a/apps/cli/src/tests/__snapshots__/generate_common_prefix_countryCode_cookies.ts +++ b/apps/cli/src/tests/__snapshots__/generate_common_prefix_countryCode_cookies.ts @@ -251,11 +251,11 @@ request: TRequest, headers: Headers ) { + updateHeaders(headers); if (request instanceof FormData) { headers.delete("Content-Type"); return request; - } else { - updateHeaders(headers); + } else { return JSON.stringify(request); } } diff --git a/apps/cli/src/tests/__snapshots__/generate_common_prefix_v1.ts b/apps/cli/src/tests/__snapshots__/generate_common_prefix_v1.ts index 2082697..2a580d9 100644 --- a/apps/cli/src/tests/__snapshots__/generate_common_prefix_v1.ts +++ b/apps/cli/src/tests/__snapshots__/generate_common_prefix_v1.ts @@ -250,11 +250,11 @@ request: TRequest, headers: Headers ) { + updateHeaders(headers); if (request instanceof FormData) { headers.delete("Content-Type"); return request; - } else { - updateHeaders(headers); + } else { return JSON.stringify(request); } } diff --git a/apps/cli/src/tests/__snapshots__/generate_common_prefix_v1_cookies.ts b/apps/cli/src/tests/__snapshots__/generate_common_prefix_v1_cookies.ts index 21cff15..ab39ac8 100644 --- a/apps/cli/src/tests/__snapshots__/generate_common_prefix_v1_cookies.ts +++ b/apps/cli/src/tests/__snapshots__/generate_common_prefix_v1_cookies.ts @@ -251,11 +251,11 @@ request: TRequest, headers: Headers ) { + updateHeaders(headers); if (request instanceof FormData) { headers.delete("Content-Type"); return request; - } else { - updateHeaders(headers); + } else { return JSON.stringify(request); } } diff --git a/apps/cli/src/tests/__snapshots__/generate_common_prefix_v2.ts b/apps/cli/src/tests/__snapshots__/generate_common_prefix_v2.ts index 309da2d..91d90ae 100644 --- a/apps/cli/src/tests/__snapshots__/generate_common_prefix_v2.ts +++ b/apps/cli/src/tests/__snapshots__/generate_common_prefix_v2.ts @@ -250,11 +250,11 @@ request: TRequest, headers: Headers ) { + updateHeaders(headers); if (request instanceof FormData) { headers.delete("Content-Type"); return request; - } else { - updateHeaders(headers); + } else { return JSON.stringify(request); } } diff --git a/apps/cli/src/tests/__snapshots__/generate_common_prefix_v2_cookies.ts b/apps/cli/src/tests/__snapshots__/generate_common_prefix_v2_cookies.ts index e9d0352..ea184af 100644 --- a/apps/cli/src/tests/__snapshots__/generate_common_prefix_v2_cookies.ts +++ b/apps/cli/src/tests/__snapshots__/generate_common_prefix_v2_cookies.ts @@ -251,11 +251,11 @@ request: TRequest, headers: Headers ) { + updateHeaders(headers); if (request instanceof FormData) { headers.delete("Content-Type"); return request; - } else { - updateHeaders(headers); + } else { return JSON.stringify(request); } } diff --git a/apps/cli/src/tests/__snapshots__/generate_multipart_formdata.ts b/apps/cli/src/tests/__snapshots__/generate_multipart_formdata.ts index 8f51d59..4629b1a 100644 --- a/apps/cli/src/tests/__snapshots__/generate_multipart_formdata.ts +++ b/apps/cli/src/tests/__snapshots__/generate_multipart_formdata.ts @@ -250,11 +250,11 @@ request: TRequest, headers: Headers ) { + updateHeaders(headers); if (request instanceof FormData) { headers.delete("Content-Type"); return request; - } else { - updateHeaders(headers); + } else { return JSON.stringify(request); } } diff --git a/apps/cli/src/tests/__snapshots__/generate_multipart_formdata_cookies.ts b/apps/cli/src/tests/__snapshots__/generate_multipart_formdata_cookies.ts index d42774f..b4d943f 100644 --- a/apps/cli/src/tests/__snapshots__/generate_multipart_formdata_cookies.ts +++ b/apps/cli/src/tests/__snapshots__/generate_multipart_formdata_cookies.ts @@ -251,11 +251,11 @@ request: TRequest, headers: Headers ) { + updateHeaders(headers); if (request instanceof FormData) { headers.delete("Content-Type"); return request; - } else { - updateHeaders(headers); + } else { return JSON.stringify(request); } } diff --git a/apps/cli/src/tests/__snapshots__/generate_multipart_formdata_multiplefiles.ts b/apps/cli/src/tests/__snapshots__/generate_multipart_formdata_multiplefiles.ts index 1653c6f..73c906e 100644 --- a/apps/cli/src/tests/__snapshots__/generate_multipart_formdata_multiplefiles.ts +++ b/apps/cli/src/tests/__snapshots__/generate_multipart_formdata_multiplefiles.ts @@ -250,11 +250,11 @@ request: TRequest, headers: Headers ) { + updateHeaders(headers); if (request instanceof FormData) { headers.delete("Content-Type"); return request; - } else { - updateHeaders(headers); + } else { return JSON.stringify(request); } } diff --git a/apps/cli/src/tests/__snapshots__/generate_multipart_formdata_multiplefiles_cookies.ts b/apps/cli/src/tests/__snapshots__/generate_multipart_formdata_multiplefiles_cookies.ts index 316d2f1..8592ffc 100644 --- a/apps/cli/src/tests/__snapshots__/generate_multipart_formdata_multiplefiles_cookies.ts +++ b/apps/cli/src/tests/__snapshots__/generate_multipart_formdata_multiplefiles_cookies.ts @@ -251,11 +251,11 @@ request: TRequest, headers: Headers ) { + updateHeaders(headers); if (request instanceof FormData) { headers.delete("Content-Type"); return request; - } else { - updateHeaders(headers); + } else { return JSON.stringify(request); } } diff --git a/apps/cli/src/tests/__snapshots__/generate_nswag.ts b/apps/cli/src/tests/__snapshots__/generate_nswag.ts index 927cb6f..ac657ba 100644 --- a/apps/cli/src/tests/__snapshots__/generate_nswag.ts +++ b/apps/cli/src/tests/__snapshots__/generate_nswag.ts @@ -250,11 +250,11 @@ request: TRequest, headers: Headers ) { + updateHeaders(headers); if (request instanceof FormData) { headers.delete("Content-Type"); return request; - } else { - updateHeaders(headers); + } else { return JSON.stringify(request); } } diff --git a/apps/cli/src/tests/__snapshots__/generate_nswag_cookies.ts b/apps/cli/src/tests/__snapshots__/generate_nswag_cookies.ts index f466e11..9b999be 100644 --- a/apps/cli/src/tests/__snapshots__/generate_nswag_cookies.ts +++ b/apps/cli/src/tests/__snapshots__/generate_nswag_cookies.ts @@ -251,11 +251,11 @@ request: TRequest, headers: Headers ) { + updateHeaders(headers); if (request instanceof FormData) { headers.delete("Content-Type"); return request; - } else { - updateHeaders(headers); + } else { return JSON.stringify(request); } } diff --git a/apps/cli/src/tests/__snapshots__/generate_one_of.ts b/apps/cli/src/tests/__snapshots__/generate_one_of.ts index 404933d..7a87766 100644 --- a/apps/cli/src/tests/__snapshots__/generate_one_of.ts +++ b/apps/cli/src/tests/__snapshots__/generate_one_of.ts @@ -250,11 +250,11 @@ request: TRequest, headers: Headers ) { + updateHeaders(headers); if (request instanceof FormData) { headers.delete("Content-Type"); return request; - } else { - updateHeaders(headers); + } else { return JSON.stringify(request); } } diff --git a/apps/cli/src/tests/__snapshots__/generate_one_of_cookies.ts b/apps/cli/src/tests/__snapshots__/generate_one_of_cookies.ts index e243925..f44c112 100644 --- a/apps/cli/src/tests/__snapshots__/generate_one_of_cookies.ts +++ b/apps/cli/src/tests/__snapshots__/generate_one_of_cookies.ts @@ -251,11 +251,11 @@ request: TRequest, headers: Headers ) { + updateHeaders(headers); if (request instanceof FormData) { headers.delete("Content-Type"); return request; - } else { - updateHeaders(headers); + } else { return JSON.stringify(request); } } diff --git a/apps/cli/src/tests/__snapshots__/generate_petstore.ts b/apps/cli/src/tests/__snapshots__/generate_petstore.ts index 25830cb..266cb95 100644 --- a/apps/cli/src/tests/__snapshots__/generate_petstore.ts +++ b/apps/cli/src/tests/__snapshots__/generate_petstore.ts @@ -250,11 +250,11 @@ request: TRequest, headers: Headers ) { + updateHeaders(headers); if (request instanceof FormData) { headers.delete("Content-Type"); return request; - } else { - updateHeaders(headers); + } else { return JSON.stringify(request); } } diff --git a/apps/cli/src/tests/__snapshots__/generate_petstore_cookies.ts b/apps/cli/src/tests/__snapshots__/generate_petstore_cookies.ts index a84cd91..439aee4 100644 --- a/apps/cli/src/tests/__snapshots__/generate_petstore_cookies.ts +++ b/apps/cli/src/tests/__snapshots__/generate_petstore_cookies.ts @@ -251,11 +251,11 @@ request: TRequest, headers: Headers ) { + updateHeaders(headers); if (request instanceof FormData) { headers.delete("Content-Type"); return request; - } else { - updateHeaders(headers); + } else { return JSON.stringify(request); } } diff --git a/apps/cli/src/tests/__snapshots__/generate_post_put_bodies.ts b/apps/cli/src/tests/__snapshots__/generate_post_put_bodies.ts index 2e08638..7f24356 100644 --- a/apps/cli/src/tests/__snapshots__/generate_post_put_bodies.ts +++ b/apps/cli/src/tests/__snapshots__/generate_post_put_bodies.ts @@ -250,11 +250,11 @@ request: TRequest, headers: Headers ) { + updateHeaders(headers); if (request instanceof FormData) { headers.delete("Content-Type"); return request; - } else { - updateHeaders(headers); + } else { return JSON.stringify(request); } } diff --git a/apps/cli/src/tests/__snapshots__/generate_post_put_bodies_cookies.ts b/apps/cli/src/tests/__snapshots__/generate_post_put_bodies_cookies.ts index 1fe2821..ab9f5a6 100644 --- a/apps/cli/src/tests/__snapshots__/generate_post_put_bodies_cookies.ts +++ b/apps/cli/src/tests/__snapshots__/generate_post_put_bodies_cookies.ts @@ -251,11 +251,11 @@ request: TRequest, headers: Headers ) { + updateHeaders(headers); if (request instanceof FormData) { headers.delete("Content-Type"); return request; - } else { - updateHeaders(headers); + } else { return JSON.stringify(request); } } diff --git a/apps/cli/src/tests/__snapshots__/generate_swagger_2_0.ts b/apps/cli/src/tests/__snapshots__/generate_swagger_2_0.ts index 5919f7f..9c4c1aa 100644 --- a/apps/cli/src/tests/__snapshots__/generate_swagger_2_0.ts +++ b/apps/cli/src/tests/__snapshots__/generate_swagger_2_0.ts @@ -250,11 +250,11 @@ request: TRequest, headers: Headers ) { + updateHeaders(headers); if (request instanceof FormData) { headers.delete("Content-Type"); return request; - } else { - updateHeaders(headers); + } else { return JSON.stringify(request); } } diff --git a/apps/cli/src/tests/__snapshots__/generate_swagger_2_0_cookies.ts b/apps/cli/src/tests/__snapshots__/generate_swagger_2_0_cookies.ts index 293ac01..70eefdb 100644 --- a/apps/cli/src/tests/__snapshots__/generate_swagger_2_0_cookies.ts +++ b/apps/cli/src/tests/__snapshots__/generate_swagger_2_0_cookies.ts @@ -251,11 +251,11 @@ request: TRequest, headers: Headers ) { + updateHeaders(headers); if (request instanceof FormData) { headers.delete("Content-Type"); return request; - } else { - updateHeaders(headers); + } else { return JSON.stringify(request); } }