test: close HTTP response bodies in server tests to satisfy lint - #8
Merged
Merged
Conversation
Co-authored-by: 0xProgress <283969857+0xProgress@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Fix failing GitHub Actions job Lint
test: close HTTP response bodies in server tests to satisfy lint
Sep 17, 2026
0xProgress
marked this pull request as ready for review
September 17, 2026 17:08
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What this PR does
Lint was failing in CI (
Lintjob, check run105300055160) due tobodyclosefindings inserver/server_test.go, where several test codepaths could exit viat.Fatalfbefore body cleanup. This change makes response-body closure explicit at response creation sites so cleanup is guaranteed even on early failures, without changing handler/runtime behavior.Root cause
golangci-lint(bodyclose) flagged multiple test cases whereresp.Bodywas not reliably closed.Change
defer closeBody(t, resp)immediately after each HTTP response is created.drainBodyfocused on reading only (no implicit close side effect).Scope
server/server_test.go(no production code changes).Related issue
Type
How I tested it
go test ./servergo test ./...golangci-lint v2.5.0 run --timeout=5m ./server(same linter version as CI)Provider PRs only
Skip this section if this is not a provider PR.
provider: <name>label)docs/providers/<name>.mdwritten fromdocs/providers/TEMPLATE.md, every section filledCONTRIBUTING.mdare checkedGeneral checklist
make checkpasses locally with no errorsfeat:,fix:,docs:,test:,refactor:,chore:,ci:)