Documentation
¶
Index ¶
- Variables
- func GetHeader(ctx context.Context, hdr string) string
- func GetObject[T any](ctx context.Context, typ string) *T
- func GetRequestBody(ctx context.Context) (io.ReadCloser, error)
- func HTTP(rw http.ResponseWriter, req *http.Request)
- type Context
- func (c *Context) Call() (any, error)
- func (c *Context) CallSpecial() (any, error)
- func (c *Context) GetDomain() string
- func (c *Context) GetExtraResponse(k string) any
- func (c *Context) GetObject(typ string) any
- func (c *Context) GetParam(v string) any
- func (c *Context) GetParamTo(v string, obj any) bool
- func (c *Context) GetParams() any
- func (c *Context) GetPath() string
- func (c *Context) GetQuery(v string) any
- func (c *Context) GetQueryFull() map[string]any
- func (c *Context) NewRequest(target string) (*http.Request, error)
- func (c *Context) RequestId() string
- func (c *Context) Response() (res *Response, err error)
- func (c *Context) ServeHTTP(rw http.ResponseWriter, req *http.Request)
- func (c *Context) SetExtraResponse(k string, v any)
- func (c *Context) SetHttp(rw http.ResponseWriter, req *http.Request) error
- func (c *Context) SetParam(name string, v any)
- func (c *Context) SetParams(v map[string]any)
- func (c *Context) SetPath(p string)
- func (c *Context) Value(v any) any
- type Deletable
- type Error
- type RequestHook
- type Response
- type ResponseHook
- type Updatable
Constants ¶
This section is empty.
Variables ¶
View Source
var ( RequestHooks []RequestHook ResponseHooks []ResponseHook )
View Source
var (
ErrTargetMissing = errors.New("missing target")
)
Functions ¶
func GetHeader ¶ added in v0.0.15
GetHeader returns the requested header or an empty string if not found
func GetRequestBody ¶ added in v0.0.15
func GetRequestBody(ctx context.Context) (io.ReadCloser, error)
GetRequestBody returns the current request's body if any, or an error
Types ¶
type Context ¶
func (*Context) CallSpecial ¶
func (*Context) GetExtraResponse ¶ added in v0.0.6
func (*Context) GetQueryFull ¶ added in v0.0.8
func (*Context) NewRequest ¶
NewRequest returns a http request for this context (for example for forwarding, etc)
func (*Context) SetExtraResponse ¶ added in v0.0.6
type Error ¶ added in v0.0.17
type Error struct {
Message string // error message
Code int // HTTP status code for error
Token string // optional error token
}
func (*Error) HTTPStatus ¶ added in v0.0.17
type RequestHook ¶ added in v0.0.20
type Response ¶
type Response struct {
Result string `json:"result"` // error|success|redirect
Error string `json:"error,omitempty"`
Token string `json:"token,omitempty"`
Code int `json:"code,omitempty"`
Debug string `json:"debug,omitempty"`
RequestId string `json:"request_id,omitempty"`
Time float64 `json:"time"`
Data any `json:"data"`
RedirectURL *url.URL `json:"redirect_url,omitempty"`
RedirectCode int `json:"redirect_code,omitempty"`
// contains filtered or unexported fields
}
type ResponseHook ¶ added in v0.0.20
Click to show internal directories.
Click to hide internal directories.