Skip to content

Fix WriteHeader + RenderJSON causing wrong Content-Type header#1980

Merged
umputun merged 1 commit intomasterfrom
fix/writeheader-renderjson-bug-1979
Dec 16, 2025
Merged

Fix WriteHeader + RenderJSON causing wrong Content-Type header#1980
umputun merged 1 commit intomasterfrom
fix/writeheader-renderjson-bug-1979

Conversation

@paskal
Copy link
Copy Markdown
Collaborator

@paskal paskal commented Dec 16, 2025

Summary

  • Fix regression from Get rid of github.com/go-chi/render use #1919 where WriteHeader() called before RenderJSON() causes Content-Type header to be ignored
  • Replace pattern with EncodeJSON() which properly sets headers before writing status code
  • Affects comment creation (201), import endpoints (202), wait timeout (504), and remap (202)

Fixes #1979

Replace WriteHeader() + RenderJSON() pattern with EncodeJSON() which
properly sets Content-Type header before writing status code. The
previous pattern caused Content-Type to default to text/plain instead
of application/json, breaking frontend JSON parsing.

Fixes #1979
@paskal paskal requested a review from umputun as a code owner December 16, 2025 17:17
@coveralls
Copy link
Copy Markdown

coveralls commented Dec 16, 2025

Pull Request Test Coverage Report for Build 20279407861

Details

  • 5 of 5 (100.0%) changed or added relevant lines in 2 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage increased (+0.02%) to 84.477%

Totals Coverage Status
Change from base Build 20042287213: 0.02%
Covered Lines: 6106
Relevant Lines: 7228

💛 - Coveralls

@umputun umputun merged commit d5b07d7 into master Dec 16, 2025
5 checks passed
@umputun umputun deleted the fix/writeheader-renderjson-bug-1979 branch December 16, 2025 19:01
@paskal paskal added this to the v1.15.0 milestone Mar 25, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Sending a comment doesn't immediately update the UI and causes a TypeError

3 participants