Documentation ¶
Index ¶
- Constants
- func SessionID(req *http.Request) string
- type Error
- func Bad(e error, msg string, args ...interface{}) Error
- func Errorf(code int, e error, msg string, args ...interface{}) Error
- func Forbidden(e error, msg string, args ...interface{}) Error
- func NotFound(e error, msg string, args ...interface{}) Error
- func Oops(e error, msg string, args ...interface{}) Error
- func Unauthorized(e error, msg string, args ...interface{}) Error
- type Handler
- type Request
- func (r *Request) ClearCookie(name, path string)
- func (r *Request) ClearSession()
- func (r *Request) Done() bool
- func (r *Request) Fail(e Error)
- func (r *Request) Missing(params ...string) bool
- func (r *Request) OK(resp interface{})
- func (r *Request) Param(name, def string) string
- func (r *Request) ParamDate(name string) *time.Time
- func (r *Request) ParamDuration(name string) *time.Duration
- func (r *Request) ParamIs(name, want string) bool
- func (r *Request) Payload(v interface{}) bool
- func (r *Request) Redirect(code int, to string)
- func (r *Request) RemoteIP() string
- func (r *Request) Respond(code int, typ, msg string, args ...interface{})
- func (r *Request) SessionID() string
- func (r *Request) SetCookie(name, val, path string)
- func (r *Request) SetSession(id string)
- func (r *Request) String() string
- func (r *Request) Success(msg string, args ...interface{})
- func (r *Request) Upgrade() *WebSocket
- func (r *Request) UserAgent() string
- type Router
- type WebSocket
Constants ¶
View Source
const ( SessionHeaderKey = "X-Shield-Session" SessionCookieKey = "shield7" )
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Error ¶
type Error struct { Diagnostic string `json:"diagnostic,omitempty"` Message string `json:"error,omitempty"` Missing []string `json:"missing,omitempty"` // contains filtered or unexported fields }
func Unauthorized ¶
func (*Error) ProvideDiagnostic ¶
func (e *Error) ProvideDiagnostic()
type Request ¶
func NewRequest ¶
NewRequest initializes and returns a new request object. Setting debug to true will cause errors to be logged.
func (*Request) ClearCookie ¶
func (*Request) ClearSession ¶
func (r *Request) ClearSession()
func (*Request) ParamDuration ¶
ParamDuration parses a duration string, example: "1m30s" that will be 1 minute and 30 seconds
func (*Request) Payload ¶
Payload unmarshals the JSON body of this request into the given interface. Returns true if successful and false otherwise.
func (*Request) SetSession ¶
type WebSocket ¶
type WebSocket struct {
// contains filtered or unexported fields
}
func (*WebSocket) SetWriteTimeout ¶
Click to show internal directories.
Click to hide internal directories.