Documentation ¶
Index ¶
- Constants
- Variables
- func Wrap(handler func(*Context)) httprouter.Handle
- type Context
- func (ctx *Context) Debug(v ...interface{})
- func (ctx *Context) Debugf(format string, v ...interface{})
- func (ctx *Context) Debugln(v ...interface{})
- func (ctx *Context) Decode(v interface{}) error
- func (ctx *Context) Log(v ...interface{})
- func (ctx *Context) Logf(format string, v ...interface{})
- func (ctx *Context) Logln(v ...interface{})
- func (ctx *Context) Reader() io.Reader
- func (ctx *Context) Respond() *Response
- func (ctx *Context) Writer() io.Writer
- type Response
Constants ¶
View Source
const ( // Unknown content type. Unknown = iota // JSON content type. JSON // Gobs content type. Gobs // Stream content type. Stream )
View Source
const ( // ContentType is used for retrieving and setting the Content-Type header. ContentType = "Content-Type" // JSONContent is used for setting the JSON Content-Type. JSONContent = "application/json" )
Variables ¶
View Source
var ( // Debug gets set to 'true' if chatty logging is desired. Debug bool )
Functions ¶
func Wrap ¶
func Wrap(handler func(*Context)) httprouter.Handle
Wrap the "httprouter" call for use with a context.
Types ¶
type Context ¶
type Context struct { W http.ResponseWriter R *http.Request PS httprouter.Params User string Password string // contains filtered or unexported fields }
Context provides a simplified interface for handling responding and logging.
func New ¶
func New( w http.ResponseWriter, r *http.Request, ps httprouter.Params, user string, password string, ) *Context
New Context constructor.
func (*Context) Debug ¶
func (ctx *Context) Debug(v ...interface{})
Debug a message without a newline.
func (*Context) Debugln ¶
func (ctx *Context) Debugln(v ...interface{})
Debugln a message and a newline.
func (*Context) Logln ¶
func (ctx *Context) Logln(v ...interface{})
Logln a message and add a newline.
type Response ¶
type Response struct {
// contains filtered or unexported fields
}
Response builder for HTTP requests.
Click to show internal directories.
Click to hide internal directories.