Documentation ¶
Index ¶
- type Client
- func (c *Client) ADD(url string, data interface{}, handler ClientRequestHandler) (err error)
- func (c *Client) Cookies(url string) []*http.Cookie
- func (c *Client) DELETE(url string, handler ClientRequestHandler) (err error)
- func (c *Client) GET(url string, handler ClientRequestHandler) (err error)
- func (c *Client) HEAD(url string) (available bool)
- func (c *Client) UPDATE(url string, data interface{}, handler ClientRequestHandler) (err error)
- type ClientConfig
- type ClientRequestHandler
- type RequestContext
- type Server
- type ServerConfig
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client for http requests
func (*Client) ADD ¶
func (c *Client) ADD(url string, data interface{}, handler ClientRequestHandler) (err error)
ADD http POST method
func (*Client) Cookies ¶ added in v0.2.0
Cookies for a url. Returns nil if the given url is invalid or has no cookies set.
func (*Client) DELETE ¶
func (c *Client) DELETE(url string, handler ClientRequestHandler) (err error)
DELETE http DELETE method
func (*Client) GET ¶
func (c *Client) GET(url string, handler ClientRequestHandler) (err error)
GET http GET method
type ClientConfig ¶
ClientConfig configuration of a client
type ClientRequestHandler ¶
ClientRequestHandler handler function for a client request
func HandleBytes ¶
func HandleBytes(bytes *[]byte) (handler ClientRequestHandler)
HandleBytes client bytes request handler
func HandleJSON ¶
func HandleJSON(data interface{}) (handler ClientRequestHandler)
HandleJSON client json request handler
func HandleStatus ¶
func HandleStatus(expected ...int) (handler ClientRequestHandler)
HandleStatus client request status handler
func HandleString ¶
func HandleString(str *string) (handler ClientRequestHandler)
HandleString client string request handler
type RequestContext ¶
type RequestContext struct { route.BaseRequestContext *gin.Context Writer http.ResponseWriter Request *http.Request }
RequestContext for a http request
type Server ¶
Server for http requests
func NewServer ¶
func NewServer(config *ServerConfig, c service.Container) (s *Server, err error)
NewServer instance creation
func (*Server) AddCSRFProtectionGroup ¶ added in v0.2.0
func (s *Server) AddCSRFProtectionGroup(path string, middleware ...route.Middleware) (newGroup *route.Group, err error)
AddCSRFProtectionGroup adds a new group of routes that uses csrf protection to the root level of the server.
func (*Server) Start ¶
func (s *Server) Start(onShutdown func(), startInBackground bool) (srv *http.Server, port int, err error)
Start the server, the returned error is already handled by the servers logger.
func (*Server) Use ¶ added in v0.3.0
func (s *Server) Use(middleware ...gin.HandlerFunc)
Use gin middleware on root
type ServerConfig ¶
type ServerConfig struct { Port int DevMode bool DefaultLang language.Tag Languages []language.Tag ReadTimeout time.Duration WriteTimeout time.Duration MaxHeaderBytes int CookieMaxAge int CookieAuthKey string CookieEncryptionKey string SessionName string SessionKey string CSRFSecret string UseCSRFProtection bool NotFoundHandler gin.HandlerFunc }
ServerConfig configuration of the http server
func DefaultServerConfig ¶
func DefaultServerConfig(cookieAuthKey string, cookieEncryptionKey string) (c *ServerConfig)
DefaultServerConfig constructor