writer

package
v0.0.0-...-cf0bdef Latest Latest
Warning

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

Go to latest
Published: Nov 16, 2017 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BasicWriter

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

basicWriter wraps a http.ResponseWriter that implements the minimal http.ResponseWriter interface.

func (*BasicWriter) BytesWritten

func (b *BasicWriter) BytesWritten() int

func (*BasicWriter) CloseNotify

func (b *BasicWriter) CloseNotify() <-chan bool

func (*BasicWriter) EnsureStatusWritten

func (b *BasicWriter) EnsureStatusWritten()

func (*BasicWriter) Flush

func (b *BasicWriter) Flush()

func (*BasicWriter) Header

func (b *BasicWriter) Header() http.Header

func (*BasicWriter) IsHijacked

func (b *BasicWriter) IsHijacked() bool

func (*BasicWriter) IsStatusSet

func (b *BasicWriter) IsStatusSet() bool

func (*BasicWriter) IsStatusWritten

func (b *BasicWriter) IsStatusWritten() bool

func (*BasicWriter) Status

func (b *BasicWriter) Status() int

func (*BasicWriter) Tee

func (b *BasicWriter) Tee(w io.Writer)

func (*BasicWriter) Unwrap

func (b *BasicWriter) Unwrap() http.ResponseWriter

func (*BasicWriter) Write

func (b *BasicWriter) Write(buf []byte) (int, error)

func (*BasicWriter) WriteHeader

func (b *BasicWriter) WriteHeader(code int)

func (*BasicWriter) WriteStatus

func (b *BasicWriter) WriteStatus(code int)

type HttpOneWriter

type HttpOneWriter struct {
	BasicWriter
	// contains filtered or unexported fields
}

HttpOneWriter is a HTTP writer that additionally satisfies http.Hijacker, and io.ReaderFrom.

func (*HttpOneWriter) Hijack

func (f *HttpOneWriter) Hijack() (net.Conn, *bufio.ReadWriter, error)

func (*HttpOneWriter) IsHijacked

func (f *HttpOneWriter) IsHijacked() bool

func (*HttpOneWriter) ReadFrom

func (f *HttpOneWriter) ReadFrom(r io.Reader) (int64, error)

type HttpTwoWriter

type HttpTwoWriter struct {
	BasicWriter
}

HttpTwoWriter is a HTTP2 writer that additionally satisfies Push

func (*HttpTwoWriter) Push

func (f *HttpTwoWriter) Push(target string, opts *http.PushOptions) error

type ResponseWriter

type ResponseWriter interface {
	http.ResponseWriter
	// Status returns the HTTP status of the request, or 0 if one has not
	// yet been sent.
	Status() int
	// BytesWritten returns the total number of bytes sent to the client.
	BytesWritten() int
	// Tee causes the response body to be written to the given io.Writer in
	// addition to proxying the writes through. Only one io.Writer can be
	// tee'd to at once: setting a second one will overwrite the first.
	// Writes will be sent to the proxy before being written to this
	// io.Writer. It is illegal for the tee'd writer to be modified
	// concurrently with writes.
	Tee(io.Writer)
	// Unwrap returns the original proxied target.
	Unwrap() http.ResponseWriter
	Flush()
	IsHijacked() bool
	IsStatusWritten() bool
	IsStatusSet() bool
	WriteStatus(int)
}

ResponseWriter is a proxy around an http.ResponseWriter that allows you to hook into various parts of the response process.

func NewResponseWriter

func NewResponseWriter(w http.ResponseWriter, protoMajor int) ResponseWriter

NewResponseWriter wraps an http.ResponseWriter, returning a proxy that allows you to hook into various parts of the response process.

Jump to

Keyboard shortcuts

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