Documentation ¶
Index ¶
- Constants
- Variables
- func DataHandle(c HTTPContext, f func() (*DataResp, error), scopes ...string)
- func DataHandlerFunc(f func(c HTTPContext) (result *DataResp, err error), scopes ...string) http.Handler
- func Handle(c HTTPContext, f func() error, scopes ...string)
- func HandlerFunc(f func(c HTTPContext) error, scopes ...string) http.Handler
- func MostAccepted(r *http.Request, name, def string) string
- type DataResp
- type DefaultHTTPContext
- func (self *DefaultHTTPContext) AccessToken(dst utils.AccessToken) (result utils.AccessToken, err error)
- func (self *DefaultHTTPContext) CheckScopes(allowedScopes []string) (err error)
- func (self *DefaultHTTPContext) MostAccepted(name, def string) string
- func (self *DefaultHTTPContext) Req() *http.Request
- func (self *DefaultHTTPContext) Resp() MemorableResponseWriter
- func (self *DefaultHTTPContext) Vars() map[string]string
- type DefaultMemorableResponseWriter
- func (self *DefaultMemorableResponseWriter) Header() http.Header
- func (self *DefaultMemorableResponseWriter) StartedAt() time.Time
- func (self *DefaultMemorableResponseWriter) Status() int
- func (self *DefaultMemorableResponseWriter) Write(b []byte) (int, error)
- func (self *DefaultMemorableResponseWriter) WriteHeader(status int)
- type HTTPContext
- type HTTPError
- type MemorableResponseWriter
- type Responder
- type Statuserr
Constants ¶
View Source
const ( ContentJSON = "application/json; charset=UTF-8" ContentJSONStream = "application/x-json-stream; charset=UTF-8" ContentExcelCSV = "application/vnd.ms-excel" ContentHTML = "text/html" )
View Source
const (
AuthorizationHeader = "Authorization"
)
Variables ¶
View Source
var ErrMissingToken = fmt.Errorf("No authorization header or token query parameter found")
View Source
var ErrorStackTraces = false
Functions ¶
func DataHandle ¶
func DataHandle(c HTTPContext, f func() (*DataResp, error), scopes ...string)
func DataHandlerFunc ¶
func Handle ¶
func Handle(c HTTPContext, f func() error, scopes ...string)
func HandlerFunc ¶
func HandlerFunc(f func(c HTTPContext) error, scopes ...string) http.Handler
Types ¶
type DataResp ¶
type DataResp struct { Data chan []interface{} Headers []string Status int ContentType string Filename string ReportName string Filters map[string][]string }
func (DataResp) Render ¶
func (self DataResp) Render(c HTTPContext) error
type DefaultHTTPContext ¶
type DefaultHTTPContext struct {
// contains filtered or unexported fields
}
func NewHTTPContext ¶
func NewHTTPContext(w http.ResponseWriter, r *http.Request) (result *DefaultHTTPContext)
func (*DefaultHTTPContext) AccessToken ¶
func (self *DefaultHTTPContext) AccessToken(dst utils.AccessToken) (result utils.AccessToken, err error)
func (*DefaultHTTPContext) CheckScopes ¶
func (self *DefaultHTTPContext) CheckScopes(allowedScopes []string) (err error)
func (*DefaultHTTPContext) MostAccepted ¶
func (self *DefaultHTTPContext) MostAccepted(name, def string) string
func (*DefaultHTTPContext) Req ¶
func (self *DefaultHTTPContext) Req() *http.Request
func (*DefaultHTTPContext) Resp ¶
func (self *DefaultHTTPContext) Resp() MemorableResponseWriter
func (*DefaultHTTPContext) Vars ¶
func (self *DefaultHTTPContext) Vars() map[string]string
type DefaultMemorableResponseWriter ¶
type DefaultMemorableResponseWriter struct { http.ResponseWriter // contains filtered or unexported fields }
func (*DefaultMemorableResponseWriter) Header ¶
func (self *DefaultMemorableResponseWriter) Header() http.Header
func (*DefaultMemorableResponseWriter) StartedAt ¶
func (self *DefaultMemorableResponseWriter) StartedAt() time.Time
func (*DefaultMemorableResponseWriter) Status ¶
func (self *DefaultMemorableResponseWriter) Status() int
func (*DefaultMemorableResponseWriter) Write ¶
func (self *DefaultMemorableResponseWriter) Write(b []byte) (int, error)
func (*DefaultMemorableResponseWriter) WriteHeader ¶
func (self *DefaultMemorableResponseWriter) WriteHeader(status int)
type HTTPContext ¶
type HTTPContext interface { Vars() map[string]string Req() *http.Request Resp() MemorableResponseWriter MostAccepted(name, def string) string AccessToken(dst utils.AccessToken) (utils.AccessToken, error) CheckScopes([]string) error }
type HTTPError ¶
func (HTTPError) Respond ¶
func (self HTTPError) Respond(c HTTPContext) (err error)
type MemorableResponseWriter ¶
type MemorableResponseWriter interface { http.ResponseWriter Status() int StartedAt() time.Time }
type Responder ¶
type Responder interface {
Respond(c HTTPContext) error
}
Click to show internal directories.
Click to hide internal directories.