Skip to content

fix: Fix content type header#769

Merged
benjaminVadon merged 4 commits into
mainfrom
fix-content-type-header
May 19, 2026
Merged

fix: Fix content type header#769
benjaminVadon merged 4 commits into
mainfrom
fix-content-type-header

Conversation

@benjaminVadon
Copy link
Copy Markdown
Contributor

No description provided.

@benjaminVadon benjaminVadon requested a review from tevincent May 19, 2026 07:44
@benjaminVadon benjaminVadon self-assigned this May 19, 2026
Copilot AI review requested due to automatic review settings May 19, 2026 07:44
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR fixes how default HTTP request headers are applied for Ktor clients, ensuring Accept / Content-Type are set using Ktor’s dedicated APIs (instead of custom header keys), which improves content negotiation and response validation consistency across the network layer.

Changes:

  • Refactors HttpUtils.applyDefaultHeaders to set Accept and Content-Type via Ktor request builder helpers and standard HttpHeaders keys.
  • Updates Ktor defaultRequest { ... } usage in clients to call applyDefaultHeaders() directly rather than nesting it under headers { ... }.
  • Corrects previously incorrect header names (e.g., Accept-type) by using canonical header constants.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.

File Description
TwoFactorAuth/Back/src/main/kotlin/TwoFactorAuthImpl.kt Updates Ktor defaultRequest to apply default headers correctly at the request-builder level.
Network/src/main/kotlin/com/infomaniak/core/network/networking/HttpUtils.kt Refactors default header application to use Ktor APIs and canonical header names (Accept, Content-Type, etc.).
Network/Ktor/src/main/kotlin/CreateHttpClient.kt Updates default Ktor client creation to apply the new default header logic.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread Network/src/main/kotlin/com/infomaniak/core/network/networking/HttpUtils.kt Outdated
@benjaminVadon benjaminVadon requested a review from sirambd May 19, 2026 10:49
@sonarqubecloud
Copy link
Copy Markdown

@benjaminVadon benjaminVadon merged commit d9a83b6 into main May 19, 2026
7 checks passed
@benjaminVadon benjaminVadon deleted the fix-content-type-header branch May 19, 2026 12:00
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.

3 participants