Skip to content

fix(context): handle missing HTML renderer - #4805

Open
Boulea7 wants to merge 2 commits into
gin-gonic:masterfrom
Boulea7:fix/3605-html-renderer-error
Open

fix(context): handle missing HTML renderer#4805
Boulea7 wants to merge 2 commits into
gin-gonic:masterfrom
Boulea7:fix/3605-html-renderer-error

Conversation

@Boulea7

@Boulea7 Boulea7 commented Aug 11, 2026

Copy link
Copy Markdown

Summary

  • avoid a nil pointer panic when Context.HTML is used without configuring an HTML renderer
  • pass the missing-renderer error through Context.Render, preserving the HTML content type and existing no-body, error, and abort behavior
  • cover GET, 204, 304, and HEAD responses

Fixes #3605

Testing

  • go test ./... -count=1
  • go test -race ./... -count=1
  • go test -tags nomsgpack ./... -count=1
  • go test -tags go_json ./... -count=1
  • go test -ldflags='-checklinkname=0' -tags sonic ./... -count=1
  • go vet ./...
  • go build ./...
  • go run github.com/golangci/golangci-lint/v2/cmd/golangci-lint@v2.11.0 run --verbose

Local baseline limitations:

  • make fmt-check reports an existing Go 1.26.5 alignment difference in unchanged binding/binding_nomsgpack.go; the changed files are formatted cleanly.
  • the locally installed golangci-lint 2.12.2 reports five findings in unchanged code; the CI-pinned 2.11.0 run reports zero issues.

Pull Request Checklist

  • Open against the master branch.
  • All tests pass in available continuous integration systems (pending).
  • Tests are added for the changed behavior.
  • Documentation is not required for this bug fix.

@codecov

codecov Bot commented Aug 11, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 98.33%. Comparing base (3dc1cd6) to head (524a96b).
⚠️ Report is 289 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #4805      +/-   ##
==========================================
- Coverage   99.21%   98.33%   -0.89%     
==========================================
  Files          42       48       +6     
  Lines        3182     3177       -5     
==========================================
- Hits         3157     3124      -33     
- Misses         17       43      +26     
- Partials        8       10       +2     
Flag Coverage Δ
?
--ldflags="-checklinkname=0" -tags sonic 98.31% <100.00%> (?)
-tags go_json 98.25% <100.00%> (?)
-tags nomsgpack 98.30% <100.00%> (?)
go-1.18 ?
go-1.19 ?
go-1.20 ?
go-1.21 ?
go-1.25 98.33% <100.00%> (?)
go-1.26 98.33% <100.00%> (?)
macos-latest 98.33% <100.00%> (-0.89%) ⬇️
ubuntu-latest 98.33% <100.00%> (-0.89%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@Boulea7
Boulea7 marked this pull request as ready for review August 11, 2026 16:42
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.

Context.HTML: Missing template import causes panic

1 participant