Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions capture_metrics.go
Original file line number Diff line number Diff line change
Expand Up @@ -84,3 +84,17 @@ func (m *Metrics) CaptureMetrics(w http.ResponseWriter, fn func(http.ResponseWri
fn(Wrap(w, hooks))
m.Duration += time.Since(start)
}

// deadliner defines two methods introduced in go 1.20. The standard library
// seems not to provide an interface we can import, hence its definition here.
type deadliner interface {
SetReadDeadline(deadline time.Time) error
SetWriteDeadline(deadline time.Time) error
}

// fullDuplexEnabler defines a method introduced in go 1.21. The standard
// library seems not to provide an interface we can import, hence its definition
// here.
type fullDuplexEnabler interface {
EnableFullDuplex() error
}
3 changes: 1 addition & 2 deletions capture_metrics_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ package httpsnoop

import (
"io"
"io/ioutil"
"log"
"net/http"
"net/http/httptest"
Expand All @@ -16,7 +15,7 @@ func TestCaptureMetrics(t *testing.T) {
// Some of the edge cases tested below cause the net/http pkg to log some
// messages that add a lot of noise to the `go test -v` output, so we discard
// the log here.
log.SetOutput(ioutil.Discard)
log.SetOutput(io.Discard)
defer log.SetOutput(os.Stderr)

tests := []struct {
Expand Down
20 changes: 16 additions & 4 deletions codegen/main.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading