Skip to content

fix(http): honour Ktor request header overrides - #2270

Open
kyboi wants to merge 1 commit into
JetBrains:developfrom
Kreoh:contribute/ktor-request-headers
Open

kyboi wants to merge 1 commit into
JetBrains:developfrom
Kreoh:contribute/ktor-request-headers

Conversation

@kyboi

@kyboi kyboi commented Sep 29, 2026

Copy link
Copy Markdown

KtorKoogHttpClient discards ordinary request headers, so a request-specific Authorization value never reaches the server. Its factory also appends configured headers even when the request supplies a replacement.

Apply headers directly to the request builder and use factory headers only when that header name is absent. Preserve explicit content types, unrelated defaults and defaults on subsequent requests.

These fixes are already included in Kroog and working in production applications using Kroog. This patch extracts the header corrections from 250069ec6 and f5580355c. No dependencies or public signatures change.

Validation: the two regression tests fail on unchanged develop. All 23 tests in the Ktor HTTP client module JVM suite pass, with no skips; the JVM JAR build and module ktlint checks pass. The compiled JVM ABI matches the checked-in dump, and public JVM descriptors are unchanged. New header-specific tests cover GET, POST and line streaming, including mixed-case overrides and subsequent requests. Existing SSE tests also pass; no new SSE header-specific test was added. The repository-wide suite and non-JVM targets were not run.

Closes #2269.

This branch has not been deployed

No deployments
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.

Ktor client ignores request headers instead of overriding defaults

1 participant