http

package
v0.5.1 Latest Latest
Warning

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

Go to latest
Published: Apr 5, 2019 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func LastHeaderValue

func LastHeaderValue(header http.Header, key string) string

LastHeaderValue gets the last value associated with the given key. It is case insensitive; textproto.CanonicalMIMEHeaderKey is used to canonicalize the provided key. If there are no values associated with the key, Get returns "".

Types

type ResponseRecorder added in v0.5.0

type ResponseRecorder struct {
	ResponseCode int
	ResponseSize int32
	// contains filtered or unexported fields
}

ResponseRecorder is an implementation of http.ResponseWriter and http.Flusher that captures the response code and size.

func NewResponseRecorder added in v0.5.0

func NewResponseRecorder(w http.ResponseWriter, responseCode int) *ResponseRecorder

NewResponseRecorder creates an http.ResponseWriter that captures the response code and size.

func (*ResponseRecorder) Flush added in v0.5.0

func (rr *ResponseRecorder) Flush()

Flush flushes the buffer to the client.

func (*ResponseRecorder) Header added in v0.5.0

func (rr *ResponseRecorder) Header() http.Header

Header returns the header map that will be sent by WriteHeader.

func (*ResponseRecorder) Hijack added in v0.5.0

func (rr *ResponseRecorder) Hijack() (net.Conn, *bufio.ReadWriter, error)

Hijack calls Hijack() on the wrapped http.ResponseWriter if it implements http.Hijacker interface, which is required for net/http/httputil/reverseproxy to handle connection upgrade/switching protocol. Otherwise returns an error.

func (*ResponseRecorder) Write added in v0.5.0

func (rr *ResponseRecorder) Write(p []byte) (int, error)

Write writes the data to the connection as part of an HTTP reply.

func (*ResponseRecorder) WriteHeader added in v0.5.0

func (rr *ResponseRecorder) WriteHeader(code int)

WriteHeader sends an HTTP response header with the provided status code.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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