httphelper

package
v0.9.2-alpha Latest Latest
Warning

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

Go to latest
Published: Dec 8, 2017 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Bytes

func Bytes(n int) []byte

Bytes .

func ContextInjector

func ContextInjector(componentName string, handler http.Handler) http.Handler

ContextInjector .

func NewRequestLogger

func NewRequestLogger(handler http.Handler) http.Handler

NewRequestLogger .

func UUID

func UUID() string

UUID .

Types

type Handler

type Handler interface {
	ServeHTTP(ctx context.Context, w http.ResponseWriter, r *http.Request)
}

Handler is an extended version of http.Handler that also takes a context argument ctx.

type HandlerFunc

type HandlerFunc func(context.Context, http.ResponseWriter, *http.Request)

The HandlerFunc type is an adapter to allow the use of ordinary functions as Handlers. If f is a function with the appropriate signature, HandlerFunc(f) is a Handler object that calls f.

func (HandlerFunc) ServeHTTP

func (f HandlerFunc) ServeHTTP(ctx context.Context, w http.ResponseWriter, r *http.Request)

ServeHTTP calls f(ctx, w, r).

type ResponseWriter

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

ResponseWriter .

func NewResponseWriter

func NewResponseWriter(w http.ResponseWriter, ctx context.Context) *ResponseWriter

NewResponseWriter .

func (*ResponseWriter) CloseNotify

func (r *ResponseWriter) CloseNotify() <-chan bool

CloseNotify .

func (*ResponseWriter) Context

func (r *ResponseWriter) Context() context.Context

Context .

func (*ResponseWriter) Flush

func (r *ResponseWriter) Flush()

Flush .

func (*ResponseWriter) Header

func (r *ResponseWriter) Header() http.Header

Header .

func (*ResponseWriter) Hijack

func (r *ResponseWriter) Hijack() (net.Conn, *bufio.ReadWriter, error)

Hijack .

func (*ResponseWriter) Status

func (r *ResponseWriter) Status() int

Status .

func (*ResponseWriter) Write

func (r *ResponseWriter) Write(b []byte) (int, error)

Write .

func (*ResponseWriter) WriteHeader

func (r *ResponseWriter) WriteHeader(s int)

WriteHeader .

func (*ResponseWriter) Written

func (r *ResponseWriter) Written() bool

Written .

Jump to

Keyboard shortcuts

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