httpwriter

package
v1.7.0 Latest Latest
Warning

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

Go to latest
Published: Aug 15, 2026 License: MIT Imports: 2 Imported by: 0

Documentation

Overview

Package httpwriter preserves optional net/http response-writer capabilities across instrumentation wrappers without advertising capabilities that the underlying writer does not provide.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Preserve

func Preserve(base http.ResponseWriter, unwrap Unwrapper, features Features) http.ResponseWriter

Preserve returns a writer with exactly the supplied optional interfaces. The explicit combinations are necessary because Go method sets are static; wrapping a dynamic http.ResponseWriter interface would otherwise hide the capabilities it carries.

Types

type CloseNotifier

type CloseNotifier interface {
	CloseNotify() <-chan bool
}

CloseNotifier preserves the legacy method still required by Gin's response writer without making new application code depend on net/http's deprecated named interface. The identical method set remains assignment-compatible.

type Features

type Features struct {
	Flusher       http.Flusher
	Hijacker      http.Hijacker
	Pusher        http.Pusher
	ReaderFrom    io.ReaderFrom
	CloseNotifier CloseNotifier
}

Features contains capability-specific delegates. A nil field means the wrapped writer does not provide that optional interface.

type Unwrapper

type Unwrapper interface {
	Unwrap() http.ResponseWriter
}

Unwrapper is the interface understood by http.ResponseController.

Jump to

Keyboard shortcuts

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