fix(go): fix Go client to normalize request header keys using Header.Set
Use http.Header.Set when writing headerParams to http.Header in the generated Go client.
Previously, generated code directly assigned values to the underlying http.Header map:
headers[h] = []string{v}
This bypasses the header name canonicalization provided by http.Header.Set and may result in inconsistent header casing or duplicate logical headers.
This change replaces direct map assignment with:
headers.Set(h, v)
Changes
- Use
http.Header.Setwhen writingheaderParamstohttp.Header. - Ensure request header names are canonicalized consistently.
- Avoid inconsistent casing or duplicate logical headers caused by direct map assignment.
- Add/update regression tests to cover the expected header handling behavior.
Related Issue
Fixes #24765
PR checklist
-
Read the [contribution guidelines](https://github.com/openapitools/openapi-generator/blob/master/CONTRIBUTING.md).
-
Run the following to [build the project](https://github.com/openapitools/openapi-generator#14---build-projects) and update samples:
./mvnw clean package || exit ./bin/generate-samples.sh ./bin/configs/*.yaml || exit ./bin/utils/export_docs_generators.sh || exit -
If your PR is targeting a particular programming language, @mention the relevant [technical committee](https://github.com/openapitools/openapi-generator/#62---openapi-generator-technical-committee) members.
Summary by cubic
Normalizes request header keys in generated Go clients by using http.Header.Set instead of direct map assignment. This canonicalizes names and prevents duplicate logical headers.
- If
headerParamscontains case-variant duplicates, only one canonical header is sent; which value is kept depends on map iteration order. - Regenerates Go samples and updates sample dependency snapshots (normalize
go.modGo versions to X.Y.0 and add missinggo.sumentries liketerraform-plugin-testing).