httpx

package
v1.25.0 Latest Latest
Warning

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

Go to latest
Published: Jun 14, 2026 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BodyReaderHandler

func BodyReaderHandler(next http.Handler, maxMemory int64) http.Handler

BodyReaderHandler reads body so it will appear in request log.

func MaxBytesHandler

func MaxBytesHandler(h http.Handler, n int64) http.Handler

func NotifyHandler

func NotifyHandler(notify NotifyFunc, next http.Handler) http.Handler

Types

type Meta

type Meta struct {
	Request  Request  `json:"request"`
	Response Response `json:"response"`
}

Meta contains HTTP-specific event metadata.

type NotifyFunc

type NotifyFunc func(
	ctx context.Context,
	remoteAddr net.Addr,
	receivedAt *time.Time,
	secure bool,
	read []byte,
	written []byte,
	combined []byte,
	meta *Meta,
)

type Option

type Option func(*options)

func NotifyStartedFunc

func NotifyStartedFunc(f func()) Option

func TLSConfig

func TLSConfig(cfg *tls.Config) Option

type Request

type Request struct {
	Method  string      `json:"method"`
	Proto   string      `json:"proto"`
	URL     string      `json:"url"`
	Host    string      `json:"host"`
	Headers http.Header `json:"headers"`
	Body    string      `json:"body"`
}

Request represents HTTP request metadata for events.

type Response

type Response struct {
	Status  int         `json:"status"`
	Headers http.Header `json:"headers"`
	Body    string      `json:"body"`
}

Response represents HTTP response metadata for events.

type Server

type Server interface {
	ListenAndServe() error
}

func New

func New(addr string, h http.Handler, opts ...Option) Server

Jump to

Keyboard shortcuts

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