ion: github.com/estebarb/ion/components/ionrw Index | Files

package ionrw

import "github.com/estebarb/ion/components/ionrw"

Package ionrw contains a http.ResponseWriter implementation

Index

Package Files

ionrw.go

func InterceptorMiddleware Uses

func InterceptorMiddleware(next http.Handler) http.Handler

InterceptorMiddleware is a middleware that changes the request ResponseWriter with this custom implementation

type ResponseWriter Uses

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

ResponseWriter is a custom implementation of http.ResponseWriter that supports registering callbacks, that are called before writing the final response.

func Interceptor Uses

func Interceptor(w http.ResponseWriter, r *http.Request) *ResponseWriter

Interceptor returns or creates a *ResponseWriter associated with the passed http.ResponseWriter and *http.Request

func New Uses

func New(w http.ResponseWriter, r *http.Request) *ResponseWriter

New creates a new *ResponseWriter based on the passed http.ResponseWriter and *http.Request

func (*ResponseWriter) AddPrecondition Uses

func (rw *ResponseWriter) AddPrecondition(fun http.HandlerFunc)

AddPrecondition adds a http.HandlerFunc that will be called before writing headers to the response.

func (*ResponseWriter) Size Uses

func (rw *ResponseWriter) Size() int

Size returns the amount of bytes written to this ResponseWriter body.

func (*ResponseWriter) Write Uses

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

Write writes the bytes passed to this ResponseWriter, but before calls all the preconditions registered.

func (*ResponseWriter) WriteHeader Uses

func (rw *ResponseWriter) WriteHeader(status int)

WriteHeader writes a header to the ResponseWriter, but before calls all the preconditions registered.

func (*ResponseWriter) Written Uses

func (rw *ResponseWriter) Written() bool

Written returns if this ResponseWriter have been already written.

Package ionrw imports 2 packages (graph). Updated 2017-01-10. Refresh now. Tools for package owners.