Documentation ¶
Index ¶
- Variables
- func HtmlErrorResponseFormatter(err exception.Exception, code int, debug bool, headers map[string]string) contract.ResponseContract
- func JsonErrorResponseFormatter(err exception.Exception, code int, debug bool, headers map[string]string) contract.ResponseContract
- func JsonResponse(data interface{}, code int, headers map[string]string) contract.ResponseContract
- type ErrorResponse
- func ErrResponse(e exception.Exception, code int, headers map[string]string) *ErrorResponse
- func ErrResponseFromError(e error, code int, headers map[string]string) *ErrorResponse
- func ErrResponseFromOrigin(resp *Response) *ErrorResponse
- func HttpErrorResponse(message string, statusCode int, code int, headers map[string]string) *ErrorResponse
- func NotFoundResponse(message string) *ErrorResponse
- type ErrorResponseFormatter
- type File
- type Request
- func (r *Request) Accepts() []byte
- func (r *Request) Authorization() []byte
- func (r *Request) BearerToken() ([]byte, error)
- func (r *Request) ExceptsJson() bool
- func (r *Request) Get(key string) []byte
- func (r *Request) GetClientIp() string
- func (r *Request) GetContent() []byte
- func (r *Request) GetInt(key string) (int, error)
- func (r *Request) GetInt64(key string) (int64, error)
- func (r *Request) GetMethod() string
- func (r *Request) GetPathBytes() []byte
- func (r *Request) GetSignature() []byte
- func (r *Request) GetString(key string) string
- func (r *Request) GetUint64(key string) (uint64, error)
- func (r *Request) Header(key string) []byte
- func (r *Request) HeaderString(key string) string
- func (r *Request) IsXmlHttpRequest() bool
- func (r *Request) Origin() *fasthttp.RequestCtx
- func (r *Request) Param(key string) string
- func (r *Request) ParamInt(key string) (int, error)
- func (r *Request) ParamInt64(key string) (int64, error)
- func (r *Request) ParamUint64(key string) (uint64, error)
- func (r *Request) Params() map[string]string
- func (r *Request) SetHeader(key string, value []byte) contract.RequestContract
- func (r *Request) SetHeaderString(key, value string) contract.RequestContract
- func (r *Request) SetParams(params map[string]string)
- func (r *Request) SetUser(u contracts.User)
- func (r *Request) Unmarshal(to interface{}) error
- func (r *Request) User() contracts.User
- type Response
- type TemplateResponse
Constants ¶
This section is empty.
Variables ¶
View Source
var ( DefaultHeader = func() map[string]string { return map[string]string{} } TextHeader = func() map[string]string { return map[string]string{ "Content-Type": "text/html; charset=utf-8", } } JsonHeader = func() map[string]string { return map[string]string{ "Content-Type": "application/json; charset=utf-8", } } HtmlHeader = func() map[string]string { return map[string]string{ "Content-Type": "text/html; charset=utf-8", } } )
Functions ¶
func JsonResponse ¶
func JsonResponse(data interface{}, code int, headers map[string]string) contract.ResponseContract
Types ¶
type ErrorResponse ¶
type ErrorResponse struct { *Response // contains filtered or unexported fields }
func ErrResponse ¶
func ErrResponseFromError ¶
func ErrResponseFromError(e error, code int, headers map[string]string) *ErrorResponse
func ErrResponseFromOrigin ¶
func ErrResponseFromOrigin(resp *Response) *ErrorResponse
func HttpErrorResponse ¶
func NotFoundResponse ¶
func NotFoundResponse(message string) *ErrorResponse
func (*ErrorResponse) E ¶
func (e *ErrorResponse) E() exception.Exception
type ErrorResponseFormatter ¶
type Request ¶
type Request struct {
// contains filtered or unexported fields
}
func NewRequest ¶
func NewRequest(origin *fasthttp.RequestCtx) *Request
func (*Request) Authorization ¶
func (*Request) BearerToken ¶
func (*Request) ExceptsJson ¶
func (*Request) GetClientIp ¶
func (*Request) GetContent ¶
func (*Request) GetPathBytes ¶
func (*Request) GetSignature ¶
func (*Request) HeaderString ¶
func (*Request) IsXmlHttpRequest ¶
func (*Request) Origin ¶
func (r *Request) Origin() *fasthttp.RequestCtx
func (*Request) SetHeader ¶
func (r *Request) SetHeader(key string, value []byte) contract.RequestContract
func (*Request) SetHeaderString ¶
func (r *Request) SetHeaderString(key, value string) contract.RequestContract
type Response ¶
type Response struct {
// contains filtered or unexported fields
}
Response http response
func HtmlResponse ¶
func TextResponse ¶
func (*Response) SetHeader ¶
func (r *Response) SetHeader(key string, value string) contract.ResponseContract
func (*Response) SetStatusCode ¶
type TemplateResponse ¶
type TemplateResponse struct { *Response // contains filtered or unexported fields }
func TempResponse ¶
func TempResponse(t *template.Template, code int, data interface{}) *TemplateResponse
func (*TemplateResponse) SetTemplateData ¶
func (t *TemplateResponse) SetTemplateData(templateData interface{}) *TemplateResponse
func (*TemplateResponse) Template ¶
func (t *TemplateResponse) Template() *template.Template
func (*TemplateResponse) TemplateData ¶
func (t *TemplateResponse) TemplateData() interface{}
Click to show internal directories.
Click to hide internal directories.