Documentation ¶
Index ¶
- Constants
- Variables
- type Auth
- type Client
- func (c *Client) Auth(auth Auth) *Client
- func (c *Client) Delete(url string) (*Response, error)
- func (c *Client) ExpectStatus(status int) *Client
- func (c *Client) Get(url string) (*Response, error)
- func (c *Client) New(u string) *Request
- func (c *Client) Post(url string, req interface{}) (*Response, error)
- func (c *Client) Protobuf() *Client
- func (c *Client) Put(url string, req interface{}) (*Response, error)
- func (c *Client) Request(method, url string, r interface{}) (*Response, error)
- type HandlerFunc
- type MiddlewareFunc
- type Request
- func (r *Request) Delete() (*Response, error)
- func (r *Request) Do(method string, v interface{}) (*Response, error)
- func (r *Request) Get() (*Response, error)
- func (r *Request) Header(name, value string) *Request
- func (r *Request) Join(path string) *Request
- func (r *Request) Param(name, value string) *Request
- func (r *Request) Post(v interface{}) (*Response, error)
- func (r *Request) Put(v interface{}) (*Response, error)
- type Response
- type Server
- func (s *Server) Delete(r *mux.Route, handler HandlerFunc) *mux.Route
- func (s *Server) Get(r *mux.Route, handler HandlerFunc) *mux.Route
- func (s *Server) HandlerFunc(handler HandlerFunc) http.Handler
- func (s *Server) JSONIndent(prefix, indent string)
- func (s *Server) Post(r *mux.Route, handler HandlerFunc) *mux.Route
- func (s *Server) Put(r *mux.Route, handler HandlerFunc) *mux.Route
- func (s *Server) Use(middlewares ...MiddlewareFunc) *Server
- type Session
- func (s *Session) Decode(val interface{}) error
- func (s *Session) RemoteHost() (net.IP, error)
- func (s *Session) RequestHeader() http.Header
- func (s *Session) ResponseHeader() http.Header
- func (s *Session) Status(status int, v interface{})
- func (s *Session) StatusCode(code int)
- func (s *Session) Statusf(code int, format string, args ...interface{})
- func (s *Session) Var(key, preset string) string
- func (s *Session) Vars() map[string]string
- type URL
Constants ¶
View Source
const ( Accept = "Accept" ContentType = "Content-Type" JsonContentType = "application/json" )
Variables ¶
View Source
var (
ProtobufContentTypes = []string{"application/protobuf", "application/x-protobuf"}
)
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct { log.Sugar Client *http.Client URL string // contains filtered or unexported fields }
func (*Client) ExpectStatus ¶
type HandlerFunc ¶
type HandlerFunc func(s *Session)
type MiddlewareFunc ¶
type MiddlewareFunc func(handler HandlerFunc) HandlerFunc
type Response ¶
type Server ¶
func (*Server) HandlerFunc ¶
func (s *Server) HandlerFunc(handler HandlerFunc) http.Handler
func (*Server) JSONIndent ¶
func (*Server) Use ¶
func (s *Server) Use(middlewares ...MiddlewareFunc) *Server
type Session ¶
type Session struct { log.Context Data map[interface{}]interface{} Request *http.Request ResponseWriter http.ResponseWriter // contains filtered or unexported fields }
func (*Session) RequestHeader ¶
func (*Session) ResponseHeader ¶
func (*Session) StatusCode ¶
Click to show internal directories.
Click to hide internal directories.