Documentation
¶
Index ¶
- func Handler(handle HandlerFunc) http.HandlerFunc
- type HandlerFunc
- type ResponseWriter
- func (rw *ResponseWriter) Bytes() []byte
- func (rw *ResponseWriter) Copy(dst http.ResponseWriter) error
- func (rw *ResponseWriter) Header() http.Header
- func (rw *ResponseWriter) Len() int
- func (rw *ResponseWriter) Read(p []byte) (int, error)
- func (rw *ResponseWriter) Reset()
- func (rw *ResponseWriter) ResponseCode() int
- func (rw *ResponseWriter) Write(buf []byte) (int, error)
- func (rw *ResponseWriter) WriteHeader(code int)
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) 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.