Skip to content

config: decode HTTP headers from JSON configuration - #1037

Open
ViktorBystrov72 wants to merge 1 commit into
prometheus:mainfrom
ViktorBystrov72:fix/json-http-headers
Open

ViktorBystrov72 wants to merge 1 commit into
prometheus:mainfrom
ViktorBystrov72:fix/json-http-headers

Conversation

@ViktorBystrov72

Copy link
Copy Markdown

Loading JSON containing http_headers currently succeeds but silently drops the headers. Headers.MarshalJSON writes the header map inline, while the default decoder expects a nested Headers field.

Add the corresponding UnmarshalJSON method. Extend the existing configuration round-trip test and HTTP request test to cover JSON values, secrets, and file-backed headers. Reserved header validation is also checked for JSON configuration. On the parent commit, the round trip loses the map and the server receives none of the configured headers.

Validation: make test GOOPTS=-race passed with Go 1.27.3 and golangci-lint 2.14.0, including root tests, lint, license, and module-tidy checks. git diff --check passed.

@roidelapluie @gotjosh

@ViktorBystrov72
ViktorBystrov72 force-pushed the fix/json-http-headers branch 2 times, most recently from 0def8da to 51b6394 Compare November 12, 2026 04:53
Signed-off-by: Виктор Быстров <anatema@bk.ru>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant