responsewriter

package
v0.0.0-...-84d4900 Latest Latest
Warning

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

Go to latest
Published: Dec 9, 2019 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Handler

func Handler(handle HandlerFunc) http.HandlerFunc

Handler is a adaptor from http handler to responsewrite handler.

Types

type HandlerFunc

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

HandlerFunc is the function signature for the http handler with a more flexible ResponseWriter.

type ResponseWriter

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

ResponseWriter implements the ResponseWriter interface

func NewResponseWriter

func NewResponseWriter() *ResponseWriter

NewResponseWriter creates a new ResponseWriter

func (*ResponseWriter) Bytes

func (rw *ResponseWriter) Bytes() []byte

Bytes resturn a slice with the current buffer.

func (*ResponseWriter) Copy

func (rw *ResponseWriter) Copy(dst http.ResponseWriter) error

Copy the data from the ResponseWriter struct to the ResponseWriter interface used in the http package.

func (*ResponseWriter) Header

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

Header return the map with the header data.

func (*ResponseWriter) Len

func (rw *ResponseWriter) Len() int

Len returns the length of the current buffer.

func (*ResponseWriter) Read

func (rw *ResponseWriter) Read(p []byte) (int, error)

Read reads the buffer to p slice and return the number of readen bytes our error.

func (*ResponseWriter) Reset

func (rw *ResponseWriter) Reset()

Reset the buffer.

func (*ResponseWriter) ResponseCode

func (rw *ResponseWriter) ResponseCode() int

ResponseCode return the actual response code.

func (*ResponseWriter) Write

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

Write the response data.

func (*ResponseWriter) WriteHeader

func (rw *ResponseWriter) WriteHeader(code int)

WriteHeader set the http response code.

Jump to

Keyboard shortcuts

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