From 9670fe99406e4ed8fc05dbb230043281b2a2b033 Mon Sep 17 00:00:00 2001 From: David Gamero Date: Wed, 19 Nov 2025 16:08:27 -0500 Subject: [PATCH 1/5] replace headers with same caseinsensitive key to match http spec --- .../main/resources/typescript/http/http.mustache | 7 +++++++ .../default/test/http/isomorphic-fetch.test.ts | 13 ++++++++++++- 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/modules/openapi-generator/src/main/resources/typescript/http/http.mustache b/modules/openapi-generator/src/main/resources/typescript/http/http.mustache index 67ff4139aee1..4c10a93a9ba7 100644 --- a/modules/openapi-generator/src/main/resources/typescript/http/http.mustache +++ b/modules/openapi-generator/src/main/resources/typescript/http/http.mustache @@ -183,6 +183,13 @@ export class RequestContext { } public setHeaderParam(key: string, value: string): void { + // Delete any existing headers with case-insensitive matching + const lowerKey = key.toLowerCase(); + for (const existingKey in this.headers) { + if (existingKey.toLowerCase() === lowerKey) { + delete this.headers[existingKey]; + } + } this.headers[key] = value; } diff --git a/samples/openapi3/client/petstore/typescript/tests/default/test/http/isomorphic-fetch.test.ts b/samples/openapi3/client/petstore/typescript/tests/default/test/http/isomorphic-fetch.test.ts index 748c7ad46e33..a08f785bd9a9 100644 --- a/samples/openapi3/client/petstore/typescript/tests/default/test/http/isomorphic-fetch.test.ts +++ b/samples/openapi3/client/petstore/typescript/tests/default/test/http/isomorphic-fetch.test.ts @@ -67,5 +67,16 @@ for (let libName in libs) { done(); }).catch(done) }) + + it("Case Insensitive Header Replacement", (done) => { + let requestContext = new petstore.RequestContext("http://httpbin.org/cookies", petstore.HttpMethod.GET); + requestContext.setHeaderParam("testkey1":"testvalue1"); + expect(requestContext.getHeaders().testkey1).to.eq("testvalue1"); + + // replace with differently cased key + requestContext.setHeaderParam("tEsTkeY1":"testvalue2"); + expect(requestContext.getHeaders().testkey1).to.be.undefined; + expect(requestContext.getHeaders().testkey1).to.eq("testvalue2"); + }) }) -} \ No newline at end of file +} From cd02b04d6b6d131e2207e4667e2e0952c44e0262 Mon Sep 17 00:00:00 2001 From: David Gamero Date: Wed, 19 Nov 2025 16:27:08 -0500 Subject: [PATCH 2/5] regenerate samples --- samples/client/echo_api/typescript/build/http/http.ts | 7 +++++++ .../others/typescript/builds/array-of-lists/http/http.ts | 7 +++++++ .../typescript/builds/enum-single-value/http/http.ts | 7 +++++++ .../typescript/builds/null-types-simple/http/http.ts | 7 +++++++ .../typescript/builds/with-unique-items/http/http.ts | 7 +++++++ .../others/typescript/encode-decode/build/http/http.ts | 7 +++++++ .../client/petstore/typescript/builds/browser/http/http.ts | 7 +++++++ .../typescript/builds/composed-schemas/http/http.ts | 7 +++++++ .../client/petstore/typescript/builds/default/http/http.ts | 7 +++++++ .../client/petstore/typescript/builds/deno/http/http.ts | 7 +++++++ .../typescript/builds/deno_object_params/http/http.ts | 7 +++++++ .../petstore/typescript/builds/explode-query/http/http.ts | 7 +++++++ .../petstore/typescript/builds/inversify/http/http.ts | 7 +++++++ .../client/petstore/typescript/builds/jquery/http/http.ts | 7 +++++++ .../petstore/typescript/builds/nullable-enum/http/http.ts | 7 +++++++ .../petstore/typescript/builds/object_params/http/http.ts | 7 +++++++ 16 files changed, 112 insertions(+) diff --git a/samples/client/echo_api/typescript/build/http/http.ts b/samples/client/echo_api/typescript/build/http/http.ts index 7eaf00563272..82d21a50a254 100644 --- a/samples/client/echo_api/typescript/build/http/http.ts +++ b/samples/client/echo_api/typescript/build/http/http.ts @@ -133,6 +133,13 @@ export class RequestContext { } public setHeaderParam(key: string, value: string): void { + // Delete any existing headers with case-insensitive matching + const lowerKey = key.toLowerCase(); + for (const existingKey in this.headers) { + if (existingKey.toLowerCase() === lowerKey) { + delete this.headers[existingKey]; + } + } this.headers[key] = value; } diff --git a/samples/client/others/typescript/builds/array-of-lists/http/http.ts b/samples/client/others/typescript/builds/array-of-lists/http/http.ts index d48cbd6b7705..3e8ffdb4cd13 100644 --- a/samples/client/others/typescript/builds/array-of-lists/http/http.ts +++ b/samples/client/others/typescript/builds/array-of-lists/http/http.ts @@ -124,6 +124,13 @@ export class RequestContext { } public setHeaderParam(key: string, value: string): void { + // Delete any existing headers with case-insensitive matching + const lowerKey = key.toLowerCase(); + for (const existingKey in this.headers) { + if (existingKey.toLowerCase() === lowerKey) { + delete this.headers[existingKey]; + } + } this.headers[key] = value; } diff --git a/samples/client/others/typescript/builds/enum-single-value/http/http.ts b/samples/client/others/typescript/builds/enum-single-value/http/http.ts index d48cbd6b7705..3e8ffdb4cd13 100644 --- a/samples/client/others/typescript/builds/enum-single-value/http/http.ts +++ b/samples/client/others/typescript/builds/enum-single-value/http/http.ts @@ -124,6 +124,13 @@ export class RequestContext { } public setHeaderParam(key: string, value: string): void { + // Delete any existing headers with case-insensitive matching + const lowerKey = key.toLowerCase(); + for (const existingKey in this.headers) { + if (existingKey.toLowerCase() === lowerKey) { + delete this.headers[existingKey]; + } + } this.headers[key] = value; } diff --git a/samples/client/others/typescript/builds/null-types-simple/http/http.ts b/samples/client/others/typescript/builds/null-types-simple/http/http.ts index d48cbd6b7705..3e8ffdb4cd13 100644 --- a/samples/client/others/typescript/builds/null-types-simple/http/http.ts +++ b/samples/client/others/typescript/builds/null-types-simple/http/http.ts @@ -124,6 +124,13 @@ export class RequestContext { } public setHeaderParam(key: string, value: string): void { + // Delete any existing headers with case-insensitive matching + const lowerKey = key.toLowerCase(); + for (const existingKey in this.headers) { + if (existingKey.toLowerCase() === lowerKey) { + delete this.headers[existingKey]; + } + } this.headers[key] = value; } diff --git a/samples/client/others/typescript/builds/with-unique-items/http/http.ts b/samples/client/others/typescript/builds/with-unique-items/http/http.ts index d48cbd6b7705..3e8ffdb4cd13 100644 --- a/samples/client/others/typescript/builds/with-unique-items/http/http.ts +++ b/samples/client/others/typescript/builds/with-unique-items/http/http.ts @@ -124,6 +124,13 @@ export class RequestContext { } public setHeaderParam(key: string, value: string): void { + // Delete any existing headers with case-insensitive matching + const lowerKey = key.toLowerCase(); + for (const existingKey in this.headers) { + if (existingKey.toLowerCase() === lowerKey) { + delete this.headers[existingKey]; + } + } this.headers[key] = value; } diff --git a/samples/client/others/typescript/encode-decode/build/http/http.ts b/samples/client/others/typescript/encode-decode/build/http/http.ts index 7eaf00563272..82d21a50a254 100644 --- a/samples/client/others/typescript/encode-decode/build/http/http.ts +++ b/samples/client/others/typescript/encode-decode/build/http/http.ts @@ -133,6 +133,13 @@ export class RequestContext { } public setHeaderParam(key: string, value: string): void { + // Delete any existing headers with case-insensitive matching + const lowerKey = key.toLowerCase(); + for (const existingKey in this.headers) { + if (existingKey.toLowerCase() === lowerKey) { + delete this.headers[existingKey]; + } + } this.headers[key] = value; } diff --git a/samples/openapi3/client/petstore/typescript/builds/browser/http/http.ts b/samples/openapi3/client/petstore/typescript/builds/browser/http/http.ts index d48cbd6b7705..3e8ffdb4cd13 100644 --- a/samples/openapi3/client/petstore/typescript/builds/browser/http/http.ts +++ b/samples/openapi3/client/petstore/typescript/builds/browser/http/http.ts @@ -124,6 +124,13 @@ export class RequestContext { } public setHeaderParam(key: string, value: string): void { + // Delete any existing headers with case-insensitive matching + const lowerKey = key.toLowerCase(); + for (const existingKey in this.headers) { + if (existingKey.toLowerCase() === lowerKey) { + delete this.headers[existingKey]; + } + } this.headers[key] = value; } diff --git a/samples/openapi3/client/petstore/typescript/builds/composed-schemas/http/http.ts b/samples/openapi3/client/petstore/typescript/builds/composed-schemas/http/http.ts index d48cbd6b7705..3e8ffdb4cd13 100644 --- a/samples/openapi3/client/petstore/typescript/builds/composed-schemas/http/http.ts +++ b/samples/openapi3/client/petstore/typescript/builds/composed-schemas/http/http.ts @@ -124,6 +124,13 @@ export class RequestContext { } public setHeaderParam(key: string, value: string): void { + // Delete any existing headers with case-insensitive matching + const lowerKey = key.toLowerCase(); + for (const existingKey in this.headers) { + if (existingKey.toLowerCase() === lowerKey) { + delete this.headers[existingKey]; + } + } this.headers[key] = value; } diff --git a/samples/openapi3/client/petstore/typescript/builds/default/http/http.ts b/samples/openapi3/client/petstore/typescript/builds/default/http/http.ts index 7eaf00563272..82d21a50a254 100644 --- a/samples/openapi3/client/petstore/typescript/builds/default/http/http.ts +++ b/samples/openapi3/client/petstore/typescript/builds/default/http/http.ts @@ -133,6 +133,13 @@ export class RequestContext { } public setHeaderParam(key: string, value: string): void { + // Delete any existing headers with case-insensitive matching + const lowerKey = key.toLowerCase(); + for (const existingKey in this.headers) { + if (existingKey.toLowerCase() === lowerKey) { + delete this.headers[existingKey]; + } + } this.headers[key] = value; } diff --git a/samples/openapi3/client/petstore/typescript/builds/deno/http/http.ts b/samples/openapi3/client/petstore/typescript/builds/deno/http/http.ts index 0b57a8a07b1b..830208d1a3d3 100644 --- a/samples/openapi3/client/petstore/typescript/builds/deno/http/http.ts +++ b/samples/openapi3/client/petstore/typescript/builds/deno/http/http.ts @@ -123,6 +123,13 @@ export class RequestContext { } public setHeaderParam(key: string, value: string): void { + // Delete any existing headers with case-insensitive matching + const lowerKey = key.toLowerCase(); + for (const existingKey in this.headers) { + if (existingKey.toLowerCase() === lowerKey) { + delete this.headers[existingKey]; + } + } this.headers[key] = value; } diff --git a/samples/openapi3/client/petstore/typescript/builds/deno_object_params/http/http.ts b/samples/openapi3/client/petstore/typescript/builds/deno_object_params/http/http.ts index 0b57a8a07b1b..830208d1a3d3 100644 --- a/samples/openapi3/client/petstore/typescript/builds/deno_object_params/http/http.ts +++ b/samples/openapi3/client/petstore/typescript/builds/deno_object_params/http/http.ts @@ -123,6 +123,13 @@ export class RequestContext { } public setHeaderParam(key: string, value: string): void { + // Delete any existing headers with case-insensitive matching + const lowerKey = key.toLowerCase(); + for (const existingKey in this.headers) { + if (existingKey.toLowerCase() === lowerKey) { + delete this.headers[existingKey]; + } + } this.headers[key] = value; } diff --git a/samples/openapi3/client/petstore/typescript/builds/explode-query/http/http.ts b/samples/openapi3/client/petstore/typescript/builds/explode-query/http/http.ts index 7eaf00563272..82d21a50a254 100644 --- a/samples/openapi3/client/petstore/typescript/builds/explode-query/http/http.ts +++ b/samples/openapi3/client/petstore/typescript/builds/explode-query/http/http.ts @@ -133,6 +133,13 @@ export class RequestContext { } public setHeaderParam(key: string, value: string): void { + // Delete any existing headers with case-insensitive matching + const lowerKey = key.toLowerCase(); + for (const existingKey in this.headers) { + if (existingKey.toLowerCase() === lowerKey) { + delete this.headers[existingKey]; + } + } this.headers[key] = value; } diff --git a/samples/openapi3/client/petstore/typescript/builds/inversify/http/http.ts b/samples/openapi3/client/petstore/typescript/builds/inversify/http/http.ts index e96c984cb800..9c0dfcdf821d 100644 --- a/samples/openapi3/client/petstore/typescript/builds/inversify/http/http.ts +++ b/samples/openapi3/client/petstore/typescript/builds/inversify/http/http.ts @@ -133,6 +133,13 @@ export class RequestContext { } public setHeaderParam(key: string, value: string): void { + // Delete any existing headers with case-insensitive matching + const lowerKey = key.toLowerCase(); + for (const existingKey in this.headers) { + if (existingKey.toLowerCase() === lowerKey) { + delete this.headers[existingKey]; + } + } this.headers[key] = value; } diff --git a/samples/openapi3/client/petstore/typescript/builds/jquery/http/http.ts b/samples/openapi3/client/petstore/typescript/builds/jquery/http/http.ts index 0fb26e3bb3f8..56e945c80d3b 100644 --- a/samples/openapi3/client/petstore/typescript/builds/jquery/http/http.ts +++ b/samples/openapi3/client/petstore/typescript/builds/jquery/http/http.ts @@ -124,6 +124,13 @@ export class RequestContext { } public setHeaderParam(key: string, value: string): void { + // Delete any existing headers with case-insensitive matching + const lowerKey = key.toLowerCase(); + for (const existingKey in this.headers) { + if (existingKey.toLowerCase() === lowerKey) { + delete this.headers[existingKey]; + } + } this.headers[key] = value; } diff --git a/samples/openapi3/client/petstore/typescript/builds/nullable-enum/http/http.ts b/samples/openapi3/client/petstore/typescript/builds/nullable-enum/http/http.ts index d48cbd6b7705..3e8ffdb4cd13 100644 --- a/samples/openapi3/client/petstore/typescript/builds/nullable-enum/http/http.ts +++ b/samples/openapi3/client/petstore/typescript/builds/nullable-enum/http/http.ts @@ -124,6 +124,13 @@ export class RequestContext { } public setHeaderParam(key: string, value: string): void { + // Delete any existing headers with case-insensitive matching + const lowerKey = key.toLowerCase(); + for (const existingKey in this.headers) { + if (existingKey.toLowerCase() === lowerKey) { + delete this.headers[existingKey]; + } + } this.headers[key] = value; } diff --git a/samples/openapi3/client/petstore/typescript/builds/object_params/http/http.ts b/samples/openapi3/client/petstore/typescript/builds/object_params/http/http.ts index 7eaf00563272..82d21a50a254 100644 --- a/samples/openapi3/client/petstore/typescript/builds/object_params/http/http.ts +++ b/samples/openapi3/client/petstore/typescript/builds/object_params/http/http.ts @@ -133,6 +133,13 @@ export class RequestContext { } public setHeaderParam(key: string, value: string): void { + // Delete any existing headers with case-insensitive matching + const lowerKey = key.toLowerCase(); + for (const existingKey in this.headers) { + if (existingKey.toLowerCase() === lowerKey) { + delete this.headers[existingKey]; + } + } this.headers[key] = value; } From 7e059eee7f9e8132be658572c3141c2e2d2f9b79 Mon Sep 17 00:00:00 2001 From: David Gamero Date: Wed, 19 Nov 2025 16:40:44 -0500 Subject: [PATCH 3/5] regenerate samples --- .../src/main/resources/typescript/http/http.mustache | 2 +- samples/client/echo_api/typescript/build/http/http.ts | 2 +- .../client/others/typescript/builds/array-of-lists/http/http.ts | 2 +- .../others/typescript/builds/enum-single-value/http/http.ts | 2 +- .../others/typescript/builds/null-types-simple/http/http.ts | 2 +- .../others/typescript/builds/with-unique-items/http/http.ts | 2 +- .../client/others/typescript/encode-decode/build/http/http.ts | 2 +- .../client/petstore/typescript/builds/browser/http/http.ts | 2 +- .../petstore/typescript/builds/composed-schemas/http/http.ts | 2 +- .../client/petstore/typescript/builds/default/http/http.ts | 2 +- .../client/petstore/typescript/builds/deno/http/http.ts | 2 +- .../petstore/typescript/builds/deno_object_params/http/http.ts | 2 +- .../petstore/typescript/builds/explode-query/http/http.ts | 2 +- .../client/petstore/typescript/builds/inversify/http/http.ts | 2 +- .../client/petstore/typescript/builds/jquery/http/http.ts | 2 +- .../petstore/typescript/builds/nullable-enum/http/http.ts | 2 +- .../petstore/typescript/builds/object_params/http/http.ts | 2 +- .../typescript/tests/default/test/http/isomorphic-fetch.test.ts | 2 +- 18 files changed, 18 insertions(+), 18 deletions(-) diff --git a/modules/openapi-generator/src/main/resources/typescript/http/http.mustache b/modules/openapi-generator/src/main/resources/typescript/http/http.mustache index 4c10a93a9ba7..6dc521f7ccc6 100644 --- a/modules/openapi-generator/src/main/resources/typescript/http/http.mustache +++ b/modules/openapi-generator/src/main/resources/typescript/http/http.mustache @@ -183,7 +183,7 @@ export class RequestContext { } public setHeaderParam(key: string, value: string): void { - // Delete any existing headers with case-insensitive matching + // Delete any existing headers with case-insensitive matching keys const lowerKey = key.toLowerCase(); for (const existingKey in this.headers) { if (existingKey.toLowerCase() === lowerKey) { diff --git a/samples/client/echo_api/typescript/build/http/http.ts b/samples/client/echo_api/typescript/build/http/http.ts index 82d21a50a254..a5f59b18c70f 100644 --- a/samples/client/echo_api/typescript/build/http/http.ts +++ b/samples/client/echo_api/typescript/build/http/http.ts @@ -133,7 +133,7 @@ export class RequestContext { } public setHeaderParam(key: string, value: string): void { - // Delete any existing headers with case-insensitive matching + // Delete any existing headers with case-insensitive matching keys const lowerKey = key.toLowerCase(); for (const existingKey in this.headers) { if (existingKey.toLowerCase() === lowerKey) { diff --git a/samples/client/others/typescript/builds/array-of-lists/http/http.ts b/samples/client/others/typescript/builds/array-of-lists/http/http.ts index 3e8ffdb4cd13..6ac932c7c23a 100644 --- a/samples/client/others/typescript/builds/array-of-lists/http/http.ts +++ b/samples/client/others/typescript/builds/array-of-lists/http/http.ts @@ -124,7 +124,7 @@ export class RequestContext { } public setHeaderParam(key: string, value: string): void { - // Delete any existing headers with case-insensitive matching + // Delete any existing headers with case-insensitive matching keys const lowerKey = key.toLowerCase(); for (const existingKey in this.headers) { if (existingKey.toLowerCase() === lowerKey) { diff --git a/samples/client/others/typescript/builds/enum-single-value/http/http.ts b/samples/client/others/typescript/builds/enum-single-value/http/http.ts index 3e8ffdb4cd13..6ac932c7c23a 100644 --- a/samples/client/others/typescript/builds/enum-single-value/http/http.ts +++ b/samples/client/others/typescript/builds/enum-single-value/http/http.ts @@ -124,7 +124,7 @@ export class RequestContext { } public setHeaderParam(key: string, value: string): void { - // Delete any existing headers with case-insensitive matching + // Delete any existing headers with case-insensitive matching keys const lowerKey = key.toLowerCase(); for (const existingKey in this.headers) { if (existingKey.toLowerCase() === lowerKey) { diff --git a/samples/client/others/typescript/builds/null-types-simple/http/http.ts b/samples/client/others/typescript/builds/null-types-simple/http/http.ts index 3e8ffdb4cd13..6ac932c7c23a 100644 --- a/samples/client/others/typescript/builds/null-types-simple/http/http.ts +++ b/samples/client/others/typescript/builds/null-types-simple/http/http.ts @@ -124,7 +124,7 @@ export class RequestContext { } public setHeaderParam(key: string, value: string): void { - // Delete any existing headers with case-insensitive matching + // Delete any existing headers with case-insensitive matching keys const lowerKey = key.toLowerCase(); for (const existingKey in this.headers) { if (existingKey.toLowerCase() === lowerKey) { diff --git a/samples/client/others/typescript/builds/with-unique-items/http/http.ts b/samples/client/others/typescript/builds/with-unique-items/http/http.ts index 3e8ffdb4cd13..6ac932c7c23a 100644 --- a/samples/client/others/typescript/builds/with-unique-items/http/http.ts +++ b/samples/client/others/typescript/builds/with-unique-items/http/http.ts @@ -124,7 +124,7 @@ export class RequestContext { } public setHeaderParam(key: string, value: string): void { - // Delete any existing headers with case-insensitive matching + // Delete any existing headers with case-insensitive matching keys const lowerKey = key.toLowerCase(); for (const existingKey in this.headers) { if (existingKey.toLowerCase() === lowerKey) { diff --git a/samples/client/others/typescript/encode-decode/build/http/http.ts b/samples/client/others/typescript/encode-decode/build/http/http.ts index 82d21a50a254..a5f59b18c70f 100644 --- a/samples/client/others/typescript/encode-decode/build/http/http.ts +++ b/samples/client/others/typescript/encode-decode/build/http/http.ts @@ -133,7 +133,7 @@ export class RequestContext { } public setHeaderParam(key: string, value: string): void { - // Delete any existing headers with case-insensitive matching + // Delete any existing headers with case-insensitive matching keys const lowerKey = key.toLowerCase(); for (const existingKey in this.headers) { if (existingKey.toLowerCase() === lowerKey) { diff --git a/samples/openapi3/client/petstore/typescript/builds/browser/http/http.ts b/samples/openapi3/client/petstore/typescript/builds/browser/http/http.ts index 3e8ffdb4cd13..6ac932c7c23a 100644 --- a/samples/openapi3/client/petstore/typescript/builds/browser/http/http.ts +++ b/samples/openapi3/client/petstore/typescript/builds/browser/http/http.ts @@ -124,7 +124,7 @@ export class RequestContext { } public setHeaderParam(key: string, value: string): void { - // Delete any existing headers with case-insensitive matching + // Delete any existing headers with case-insensitive matching keys const lowerKey = key.toLowerCase(); for (const existingKey in this.headers) { if (existingKey.toLowerCase() === lowerKey) { diff --git a/samples/openapi3/client/petstore/typescript/builds/composed-schemas/http/http.ts b/samples/openapi3/client/petstore/typescript/builds/composed-schemas/http/http.ts index 3e8ffdb4cd13..6ac932c7c23a 100644 --- a/samples/openapi3/client/petstore/typescript/builds/composed-schemas/http/http.ts +++ b/samples/openapi3/client/petstore/typescript/builds/composed-schemas/http/http.ts @@ -124,7 +124,7 @@ export class RequestContext { } public setHeaderParam(key: string, value: string): void { - // Delete any existing headers with case-insensitive matching + // Delete any existing headers with case-insensitive matching keys const lowerKey = key.toLowerCase(); for (const existingKey in this.headers) { if (existingKey.toLowerCase() === lowerKey) { diff --git a/samples/openapi3/client/petstore/typescript/builds/default/http/http.ts b/samples/openapi3/client/petstore/typescript/builds/default/http/http.ts index 82d21a50a254..a5f59b18c70f 100644 --- a/samples/openapi3/client/petstore/typescript/builds/default/http/http.ts +++ b/samples/openapi3/client/petstore/typescript/builds/default/http/http.ts @@ -133,7 +133,7 @@ export class RequestContext { } public setHeaderParam(key: string, value: string): void { - // Delete any existing headers with case-insensitive matching + // Delete any existing headers with case-insensitive matching keys const lowerKey = key.toLowerCase(); for (const existingKey in this.headers) { if (existingKey.toLowerCase() === lowerKey) { diff --git a/samples/openapi3/client/petstore/typescript/builds/deno/http/http.ts b/samples/openapi3/client/petstore/typescript/builds/deno/http/http.ts index 830208d1a3d3..c71b19bf2895 100644 --- a/samples/openapi3/client/petstore/typescript/builds/deno/http/http.ts +++ b/samples/openapi3/client/petstore/typescript/builds/deno/http/http.ts @@ -123,7 +123,7 @@ export class RequestContext { } public setHeaderParam(key: string, value: string): void { - // Delete any existing headers with case-insensitive matching + // Delete any existing headers with case-insensitive matching keys const lowerKey = key.toLowerCase(); for (const existingKey in this.headers) { if (existingKey.toLowerCase() === lowerKey) { diff --git a/samples/openapi3/client/petstore/typescript/builds/deno_object_params/http/http.ts b/samples/openapi3/client/petstore/typescript/builds/deno_object_params/http/http.ts index 830208d1a3d3..c71b19bf2895 100644 --- a/samples/openapi3/client/petstore/typescript/builds/deno_object_params/http/http.ts +++ b/samples/openapi3/client/petstore/typescript/builds/deno_object_params/http/http.ts @@ -123,7 +123,7 @@ export class RequestContext { } public setHeaderParam(key: string, value: string): void { - // Delete any existing headers with case-insensitive matching + // Delete any existing headers with case-insensitive matching keys const lowerKey = key.toLowerCase(); for (const existingKey in this.headers) { if (existingKey.toLowerCase() === lowerKey) { diff --git a/samples/openapi3/client/petstore/typescript/builds/explode-query/http/http.ts b/samples/openapi3/client/petstore/typescript/builds/explode-query/http/http.ts index 82d21a50a254..a5f59b18c70f 100644 --- a/samples/openapi3/client/petstore/typescript/builds/explode-query/http/http.ts +++ b/samples/openapi3/client/petstore/typescript/builds/explode-query/http/http.ts @@ -133,7 +133,7 @@ export class RequestContext { } public setHeaderParam(key: string, value: string): void { - // Delete any existing headers with case-insensitive matching + // Delete any existing headers with case-insensitive matching keys const lowerKey = key.toLowerCase(); for (const existingKey in this.headers) { if (existingKey.toLowerCase() === lowerKey) { diff --git a/samples/openapi3/client/petstore/typescript/builds/inversify/http/http.ts b/samples/openapi3/client/petstore/typescript/builds/inversify/http/http.ts index 9c0dfcdf821d..b2c101e5f228 100644 --- a/samples/openapi3/client/petstore/typescript/builds/inversify/http/http.ts +++ b/samples/openapi3/client/petstore/typescript/builds/inversify/http/http.ts @@ -133,7 +133,7 @@ export class RequestContext { } public setHeaderParam(key: string, value: string): void { - // Delete any existing headers with case-insensitive matching + // Delete any existing headers with case-insensitive matching keys const lowerKey = key.toLowerCase(); for (const existingKey in this.headers) { if (existingKey.toLowerCase() === lowerKey) { diff --git a/samples/openapi3/client/petstore/typescript/builds/jquery/http/http.ts b/samples/openapi3/client/petstore/typescript/builds/jquery/http/http.ts index 56e945c80d3b..db24c4927063 100644 --- a/samples/openapi3/client/petstore/typescript/builds/jquery/http/http.ts +++ b/samples/openapi3/client/petstore/typescript/builds/jquery/http/http.ts @@ -124,7 +124,7 @@ export class RequestContext { } public setHeaderParam(key: string, value: string): void { - // Delete any existing headers with case-insensitive matching + // Delete any existing headers with case-insensitive matching keys const lowerKey = key.toLowerCase(); for (const existingKey in this.headers) { if (existingKey.toLowerCase() === lowerKey) { diff --git a/samples/openapi3/client/petstore/typescript/builds/nullable-enum/http/http.ts b/samples/openapi3/client/petstore/typescript/builds/nullable-enum/http/http.ts index 3e8ffdb4cd13..6ac932c7c23a 100644 --- a/samples/openapi3/client/petstore/typescript/builds/nullable-enum/http/http.ts +++ b/samples/openapi3/client/petstore/typescript/builds/nullable-enum/http/http.ts @@ -124,7 +124,7 @@ export class RequestContext { } public setHeaderParam(key: string, value: string): void { - // Delete any existing headers with case-insensitive matching + // Delete any existing headers with case-insensitive matching keys const lowerKey = key.toLowerCase(); for (const existingKey in this.headers) { if (existingKey.toLowerCase() === lowerKey) { diff --git a/samples/openapi3/client/petstore/typescript/builds/object_params/http/http.ts b/samples/openapi3/client/petstore/typescript/builds/object_params/http/http.ts index 82d21a50a254..a5f59b18c70f 100644 --- a/samples/openapi3/client/petstore/typescript/builds/object_params/http/http.ts +++ b/samples/openapi3/client/petstore/typescript/builds/object_params/http/http.ts @@ -133,7 +133,7 @@ export class RequestContext { } public setHeaderParam(key: string, value: string): void { - // Delete any existing headers with case-insensitive matching + // Delete any existing headers with case-insensitive matching keys const lowerKey = key.toLowerCase(); for (const existingKey in this.headers) { if (existingKey.toLowerCase() === lowerKey) { diff --git a/samples/openapi3/client/petstore/typescript/tests/default/test/http/isomorphic-fetch.test.ts b/samples/openapi3/client/petstore/typescript/tests/default/test/http/isomorphic-fetch.test.ts index a08f785bd9a9..cd7e446a8a45 100644 --- a/samples/openapi3/client/petstore/typescript/tests/default/test/http/isomorphic-fetch.test.ts +++ b/samples/openapi3/client/petstore/typescript/tests/default/test/http/isomorphic-fetch.test.ts @@ -76,7 +76,7 @@ for (let libName in libs) { // replace with differently cased key requestContext.setHeaderParam("tEsTkeY1":"testvalue2"); expect(requestContext.getHeaders().testkey1).to.be.undefined; - expect(requestContext.getHeaders().testkey1).to.eq("testvalue2"); + expect(requestContext.getHeaders().tEsTkeY1).to.eq("testvalue2"); }) }) } From dee493e8aaa29ba0b131eb960892f3aed5411fbf Mon Sep 17 00:00:00 2001 From: David Gamero Date: Thu, 20 Nov 2025 17:42:54 -0500 Subject: [PATCH 4/5] enable test for header case-insensitive replacement --- .../test/http/isomorphic-fetch.test.ts | 21 ++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) diff --git a/samples/openapi3/client/petstore/typescript/tests/default/test/http/isomorphic-fetch.test.ts b/samples/openapi3/client/petstore/typescript/tests/default/test/http/isomorphic-fetch.test.ts index cd7e446a8a45..9129cfca1a03 100644 --- a/samples/openapi3/client/petstore/typescript/tests/default/test/http/isomorphic-fetch.test.ts +++ b/samples/openapi3/client/petstore/typescript/tests/default/test/http/isomorphic-fetch.test.ts @@ -68,15 +68,30 @@ for (let libName in libs) { }).catch(done) }) - it("Case Insensitive Header Replacement", (done) => { + }) + describe("Header Case Sensitivity", () => { + it("different case header key is replaced", () => { let requestContext = new petstore.RequestContext("http://httpbin.org/cookies", petstore.HttpMethod.GET); - requestContext.setHeaderParam("testkey1":"testvalue1"); + expect(requestContext.getHeaders().testkey1).to.be.undefined; + + requestContext.setHeaderParam("testkey1","testvalue1"); expect(requestContext.getHeaders().testkey1).to.eq("testvalue1"); // replace with differently cased key - requestContext.setHeaderParam("tEsTkeY1":"testvalue2"); + requestContext.setHeaderParam("tEsTkeY1","testvalue2"); expect(requestContext.getHeaders().testkey1).to.be.undefined; expect(requestContext.getHeaders().tEsTkeY1).to.eq("testvalue2"); }) + it("indentical header key writes replace content", () => { + let requestContext = new petstore.RequestContext("http://httpbin.org/cookies", petstore.HttpMethod.GET); + expect(requestContext.getHeaders().testkey1).to.be.undefined; + + requestContext.setHeaderParam("testkey1","testvalue1"); + expect(requestContext.getHeaders().testkey1).to.eq("testvalue1"); + + // replace with differently cased key + requestContext.setHeaderParam("testkey1","testvalue2"); + expect(requestContext.getHeaders().testkey1).to.eq("testvalue2"); + }) }) } From 87fc74eb4e9dbf9dce480e10e2ccfbfcf320830d Mon Sep 17 00:00:00 2001 From: David Gamero Date: Thu, 20 Nov 2025 17:50:21 -0500 Subject: [PATCH 5/5] reduce redundant test comments --- .../typescript/tests/default/test/http/isomorphic-fetch.test.ts | 2 -- 1 file changed, 2 deletions(-) diff --git a/samples/openapi3/client/petstore/typescript/tests/default/test/http/isomorphic-fetch.test.ts b/samples/openapi3/client/petstore/typescript/tests/default/test/http/isomorphic-fetch.test.ts index 9129cfca1a03..a99e4c652672 100644 --- a/samples/openapi3/client/petstore/typescript/tests/default/test/http/isomorphic-fetch.test.ts +++ b/samples/openapi3/client/petstore/typescript/tests/default/test/http/isomorphic-fetch.test.ts @@ -77,7 +77,6 @@ for (let libName in libs) { requestContext.setHeaderParam("testkey1","testvalue1"); expect(requestContext.getHeaders().testkey1).to.eq("testvalue1"); - // replace with differently cased key requestContext.setHeaderParam("tEsTkeY1","testvalue2"); expect(requestContext.getHeaders().testkey1).to.be.undefined; expect(requestContext.getHeaders().tEsTkeY1).to.eq("testvalue2"); @@ -89,7 +88,6 @@ for (let libName in libs) { requestContext.setHeaderParam("testkey1","testvalue1"); expect(requestContext.getHeaders().testkey1).to.eq("testvalue1"); - // replace with differently cased key requestContext.setHeaderParam("testkey1","testvalue2"); expect(requestContext.getHeaders().testkey1).to.eq("testvalue2"); })