Documentation ¶
Index ¶
- type Handler
- type Request
- type Response
- func (r *Response) Abort(status int, body string)
- func (r *Response) BadRequest()
- func (r *Response) ContentType(val string) string
- func (r *Response) Forbidden()
- func (r *Response) NotAllowed()
- func (r *Response) NotFound(message string)
- func (r *Response) NotModified()
- func (r *Response) Ok(message string)
- func (r *Response) PermanentRedirect(url string)
- func (r *Response) Redirect(status int, url_ string)
- func (r *Response) SetHeader(hdr string, val string, unique bool)
- func (r *Response) SetHeaders(headers map[string]string, unique bool)
- func (r *Response) Unauthorized()
- func (r *Response) WriteString(content string)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Request ¶
type Request struct { Request *http.Request Params map[string]string QueryString map[string]string }
func NewRequest ¶
func (*Request) CurrentRoute ¶
CurrentRoute allows to retrieve the current from a request
type Response ¶
type Response struct {
http.ResponseWriter
}
func NewResponse ¶
func NewResponse(res http.ResponseWriter) Response
func (*Response) Abort ¶
Abort is a helper method that sends an HTTP header and an optional body. It is useful for returning 4xx or 5xx errors. Once it has been called, any return value from the handler will not be written to the response.
func (*Response) ContentType ¶
ContentType sets the Content-Type header for an HTTP response. For example, ctx.ContentType("json") sets the content-type to "application/json" If the supplied value contains a slash (/) it is set as the Content-Type verbatim. The return value is the content type as it was set, or an empty string if none was found.
func (*Response) NotModified ¶
func (r *Response) NotModified()
Notmodified writes a 304 HTTP response
func (*Response) PermanentRedirect ¶
PermanentRedirect is a helper method for 301 redirect
func (*Response) SetHeader ¶
SetHeader sets a response header. If `unique` is true, the current value of that header will be overwritten . If false, it will be appended.
func (*Response) SetHeaders ¶
SetHeaders sets response headers. If `unique` is true, the current value of that header will be overwritten . If false, it will be appended.
func (*Response) Unauthorized ¶
func (r *Response) Unauthorized()
Unauthorized writes a 401 HTTP response
func (*Response) WriteString ¶
WriteString writes string data into the response object.