Help us shape the future of Go! Take the 2026 Go Developer Survey

debugmiddleware

package
v1.46.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 29, 2026 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DefaultCaptureBytes  = 16 * 1024
	MaximumCaptureBytes  = 1024 * 1024
	DefaultCaptureEvents = 64
	MaximumCaptureEvents = 4096
)

Variables

This section is empty.

Functions

func DeferResponseBodyTiming added in v1.41.0

func DeferResponseBodyTiming(response *http.Response) func()

DeferResponseBodyTiming records all response body diagnostics until the returned function runs. Binary consumers select it before reading and finish after their resource cleanup and final body close. SDK body wrappers do not hide the request metadata. Reporting can still wait for stderr; Read and Close in this mode cannot.

Types

type CaptureOptions added in v1.41.0

type CaptureOptions struct {
	Bodies, SSEFrames, EventTiming bool
	MaxBytes, MaxEvents            int
}

CaptureOptions enables separate, bounded diagnostic views. These limits never restrict the request or response delivered to the transport or caller.

type Middleware

type Middleware = func(*http.Request, MiddlewareNext) (*http.Response, error)

For the time being these type definitions are duplicated here so that we can test this file in a non-generated context.

type MiddlewareNext

type MiddlewareNext = func(*http.Request) (*http.Response, error)

For the time being these type definitions are duplicated here so that we can test this file in a non-generated context.

type RequestLogger

type RequestLogger struct {
	// contains filtered or unexported fields
}

RequestLogger is a middleware that logs HTTP requests and responses.

func NewRequestLogger

func NewRequestLogger(additionalSensitiveHeaders ...string) *RequestLogger

NewRequestLogger redacts known credential headers and any additional header names.

func NewRequestLoggerWithOptions added in v1.41.0

func NewRequestLoggerWithOptions(capture CaptureOptions, additionalSensitiveHeaders ...string) *RequestLogger

NewRequestLoggerWithOptions adds explicit bounded payload diagnostics.

func (*RequestLogger) Middleware

func (m *RequestLogger) Middleware() Middleware

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL