Documentation ¶
Overview ¶
Response package provides the core functionality of handling the client connection, chunked response and other features
Index ¶
- type NextFunc
- type Response
- func (res *Response) AddCookie(key string, value string)
- func (res *Response) Download(path string, file_name string) bool
- func (res *Response) End()
- func (res *Response) Error(status int, str string)
- func (res *Response) GetBuffer() *bufio.ReadWriter
- func (res *Response) GetConnection() net.Conn
- func (res *Response) GetRaw() http.ResponseWriter
- func (res *Response) HasEnded() bool
- func (res *Response) Init(rs http.ResponseWriter, r *http.Request, w *bufio.ReadWriter, con net.Conn, ...) *Response
- func (res *Response) JSON(content interface{})
- func (res *Response) Redirect(url string) *Response
- func (res *Response) SendFile(url string, noCache bool) bool
- func (res *Response) Write(content string) *Response
- func (res *Response) WriteBytes(bytes []byte) *Response
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Response ¶
type Response struct { Header *header.Header Cookie *cookie.Cookie Locals map[string]interface{} // contains filtered or unexported fields }
Response Structure extends basic http.ResponseWriter interface It encapsulates Header and Cookie class for direct access
func (*Response) End ¶
func (res *Response) End()
Ends a response and drops the connection with client
func (*Response) GetBuffer ¶
func (res *Response) GetBuffer() *bufio.ReadWriter
A helper for middlewares to get the original Request buffer
func (*Response) GetConnection ¶
A helper for middlewares to get the original net.Conn
func (*Response) GetRaw ¶
func (res *Response) GetRaw() http.ResponseWriter
A helper for middlewares to get the original http.ResponseWriter
func (*Response) Init ¶
func (res *Response) Init(rs http.ResponseWriter, r *http.Request, w *bufio.ReadWriter, con net.Conn, props *map[string]interface{}) *Response
Intialise the Response Struct, requires the Hijacked buffer, connection and Response interface
func (*Response) JSON ¶
func (res *Response) JSON(content interface{})
Send JSON response, takes interface as input
func (*Response) SendFile ¶
Reads a file in buffer and writes it to the socket It also checks with the existing E-Tags list so as to provide caching.
func (*Response) WriteBytes ¶
Writes an array of bytes to the socket