Skip to content

Conversation

@umputun
Copy link
Member

@umputun umputun commented Jan 8, 2026

Ping middleware now handles both GET and HEAD methods for the /ping endpoint. HEAD returns 200 OK with headers but no body, which is useful for lightweight health checks by monitoring tools.

Changes:

  • Ping middleware accepts HEAD in addition to GET
  • HEAD returns status and headers only (no "pong" body)
  • Refactored tests to use subtests covering GET, HEAD, POST, and other paths

Also includes:

  • Dependency updates (golang.org/x/crypto, golang.org/x/sys)
  • Modernize linter fixes: interface{}any, max() builtin, strings.SplitSeq

- Ping middleware now handles both GET and HEAD methods for /ping endpoint
- HEAD returns 200 OK with headers but no body (useful for lightweight health checks)
- Update dependencies: golang.org/x/crypto 0.45.0 -> 0.46.0, golang.org/x/sys 0.38.0 -> 0.39.0
- Apply modernize linter fixes:
  - Replace interface{} with any
  - Use max() builtin instead of if/else
  - Use strings.SplitSeq for more efficient iteration
Copilot AI review requested due to automatic review settings January 8, 2026 05:19
@umputun umputun merged commit 0c9258a into master Jan 8, 2026
6 checks passed
@umputun umputun deleted the add-ping-head-support branch January 8, 2026 05:21
@coveralls
Copy link

Pull Request Test Coverage Report for Build 20806401957

Details

  • 10 of 10 (100.0%) changed or added relevant lines in 4 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage increased (+0.2%) to 88.172%

Totals Coverage Status
Change from base Build 20444828212: 0.2%
Covered Lines: 738
Relevant Lines: 837

💛 - Coveralls

Copy link

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 pull request adds HEAD method support to the Ping middleware for lightweight health checks and includes dependency updates and linter-driven modernization fixes.

Key changes:

  • Ping middleware now accepts HEAD requests in addition to GET, returning status and headers without a body
  • Modernization: replaced interface{} with any alias throughout the codebase
  • Applied modern Go idioms: max() builtin and strings.SplitSeq iterator pattern

Reviewed changes

Copilot reviewed 9 out of 10 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
middleware.go Added HEAD method support to Ping middleware with proper documentation
middleware_test.go Refactored tests into subtests covering GET, HEAD, POST, and other paths
rest.go Replaced interface{} with any in function signatures
logger/logger.go Replaced interface{} with any in Backend interface and implementation
gzip.go Replaced interface{} with any in sync.Pool definition
benchmarks.go Modernized interval calculation using max() builtin
realip/real.go Attempted to use strings.SplitSeq for iteration
go.mod Updated golang.org/x/crypto from v0.45.0 to v0.46.0 and golang.org/x/sys from v0.38.0 to v0.39.0
go.sum Updated checksums for dependency updates
.golangci.yml Added modernize and testifylint linters

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

if xff := r.Header.Get("X-Forwarded-For"); xff != "" {
addresses := strings.Split(xff, ",")
for _, addr := range addresses {
for addr := range strings.SplitSeq(xff, ",") {
Copy link

Copilot AI Jan 8, 2026

Choose a reason for hiding this comment

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

The function strings.SplitSeq does not exist in the Go standard library. The standard function is strings.Split which returns a slice of strings. If you intended to use an iterator-based approach available in Go 1.23+, you would need strings.Fields or similar, but strings.SplitSeq is not a valid function name. This change will cause a compilation error.

Suggested change
for addr := range strings.SplitSeq(xff, ",") {
for _, addr := range strings.Split(xff, ",") {

Copilot uses AI. Check for mistakes.
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