Documentation ¶
Index ¶
- Constants
- func SetOperation(ctx context.Context, op string)
- type Context
- type HandlerFunc
- type Router
- func (r *Router) CONNECT(path string, h HandlerFunc, m ...kHttp.FilterFunc)
- func (r *Router) DELETE(path string, h HandlerFunc, m ...kHttp.FilterFunc)
- func (r *Router) GET(path string, h HandlerFunc, m ...kHttp.FilterFunc)
- func (r *Router) Group(prefix string, filters ...kHttp.FilterFunc) *Router
- func (r *Router) HEAD(path string, h HandlerFunc, m ...kHttp.FilterFunc)
- func (r *Router) Handle(method, relativePath string, h HandlerFunc, filters ...kHttp.FilterFunc)
- func (r *Router) OPTIONS(path string, h HandlerFunc, m ...kHttp.FilterFunc)
- func (r *Router) PATCH(path string, h HandlerFunc, m ...kHttp.FilterFunc)
- func (r *Router) POST(path string, h HandlerFunc, m ...kHttp.FilterFunc)
- func (r *Router) PUT(path string, h HandlerFunc, m ...kHttp.FilterFunc)
- func (r *Router) TRACE(path string, h HandlerFunc, m ...kHttp.FilterFunc)
- type Server
- func (s *Server) Endpoint() (*url.URL, error)
- func (s *Server) Handle(path string, h http.Handler)
- func (s *Server) HandleFunc(path string, h http.HandlerFunc)
- func (s *Server) HandleHeader(key, val string, h http.HandlerFunc)
- func (s *Server) HandlePrefix(prefix string, h http.Handler)
- func (s *Server) Route(prefix string, filters ...kHttp.FilterFunc) *Router
- func (s *Server) ServeHTTP(res http.ResponseWriter, req *http.Request)
- func (s *Server) Start(ctx context.Context) error
- func (s *Server) Stop(ctx context.Context) error
- type ServerOption
- func WithAddress(addr string) ServerOption
- func WithErrorEncoder(en kHttp.EncodeErrorFunc) ServerOption
- func WithFilter(filters ...kHttp.FilterFunc) ServerOption
- func WithMiddleware(m ...middleware.Middleware) ServerOption
- func WithRequestDecoder(dec kHttp.DecodeRequestFunc) ServerOption
- func WithResponseEncoder(en kHttp.EncodeResponseFunc) ServerOption
- func WithStrictSlash(strictSlash bool) ServerOption
- func WithTLSConfig(c *tls.Config) ServerOption
- func WithTimeout(timeout time.Duration) ServerOption
- type Transport
- func (tr *Transport) Endpoint() string
- func (tr *Transport) Kind() transport.Kind
- func (tr *Transport) Operation() string
- func (tr *Transport) PathTemplate() string
- func (tr *Transport) ReplyHeader() transport.Header
- func (tr *Transport) Request() *http.Request
- func (tr *Transport) RequestHeader() transport.Header
- type Transporter
Constants ¶
const (
KindHTTP3 transport.Kind = "http3"
)
Variables ¶
This section is empty.
Functions ¶
func SetOperation ¶
SetOperation sets the transport operation.
Types ¶
type Context ¶
type Context interface { context.Context Vars() url.Values Query() url.Values Form() url.Values Header() http.Header Request() *http.Request Response() http.ResponseWriter Middleware(middleware.Handler) middleware.Handler Bind(interface{}) error BindVars(interface{}) error BindQuery(interface{}) error BindForm(interface{}) error Returns(interface{}, error) error Result(int, interface{}) error JSON(int, interface{}) error XML(int, interface{}) error String(int, string) error Blob(int, string, []byte) error Stream(int, string, io.Reader) error Reset(http.ResponseWriter, *http.Request) }
Context is an HTTP Context.
type HandlerFunc ¶
HandlerFunc defines a function to serve HTTP requests.
type Router ¶
type Router struct {
// contains filtered or unexported fields
}
Router is an HTTP router.
func (*Router) CONNECT ¶
func (r *Router) CONNECT(path string, h HandlerFunc, m ...kHttp.FilterFunc)
CONNECT registers a new CONNECT route for a path with matching handler in the router.
func (*Router) DELETE ¶
func (r *Router) DELETE(path string, h HandlerFunc, m ...kHttp.FilterFunc)
DELETE registers a new DELETE route for a path with matching handler in the router.
func (*Router) GET ¶
func (r *Router) GET(path string, h HandlerFunc, m ...kHttp.FilterFunc)
GET registers a new GET route for a path with matching handler in the router.
func (*Router) Group ¶
func (r *Router) Group(prefix string, filters ...kHttp.FilterFunc) *Router
Group returns a new router group.
func (*Router) HEAD ¶
func (r *Router) HEAD(path string, h HandlerFunc, m ...kHttp.FilterFunc)
HEAD registers a new HEAD route for a path with matching handler in the router.
func (*Router) Handle ¶
func (r *Router) Handle(method, relativePath string, h HandlerFunc, filters ...kHttp.FilterFunc)
Handle registers a new route with a matcher for the URL path and method.
func (*Router) OPTIONS ¶
func (r *Router) OPTIONS(path string, h HandlerFunc, m ...kHttp.FilterFunc)
OPTIONS registers a new OPTIONS route for a path with matching handler in the router.
func (*Router) PATCH ¶
func (r *Router) PATCH(path string, h HandlerFunc, m ...kHttp.FilterFunc)
PATCH registers a new PATCH route for a path with matching handler in the router.
func (*Router) POST ¶
func (r *Router) POST(path string, h HandlerFunc, m ...kHttp.FilterFunc)
POST registers a new POST route for a path with matching handler in the router.
func (*Router) PUT ¶
func (r *Router) PUT(path string, h HandlerFunc, m ...kHttp.FilterFunc)
PUT registers a new PUT route for a path with matching handler in the router.
func (*Router) TRACE ¶
func (r *Router) TRACE(path string, h HandlerFunc, m ...kHttp.FilterFunc)
TRACE registers a new TRACE route for a path with matching handler in the router.
type Server ¶
func NewServer ¶
func NewServer(opts ...ServerOption) *Server
func (*Server) HandleFunc ¶
func (s *Server) HandleFunc(path string, h http.HandlerFunc)
func (*Server) HandleHeader ¶
func (s *Server) HandleHeader(key, val string, h http.HandlerFunc)
type ServerOption ¶
type ServerOption func(*Server)
func WithAddress ¶
func WithAddress(addr string) ServerOption
func WithErrorEncoder ¶
func WithErrorEncoder(en kHttp.EncodeErrorFunc) ServerOption
func WithFilter ¶
func WithFilter(filters ...kHttp.FilterFunc) ServerOption
func WithMiddleware ¶
func WithMiddleware(m ...middleware.Middleware) ServerOption
func WithRequestDecoder ¶
func WithRequestDecoder(dec kHttp.DecodeRequestFunc) ServerOption
func WithResponseEncoder ¶
func WithResponseEncoder(en kHttp.EncodeResponseFunc) ServerOption
func WithStrictSlash ¶
func WithStrictSlash(strictSlash bool) ServerOption
func WithTLSConfig ¶
func WithTLSConfig(c *tls.Config) ServerOption
func WithTimeout ¶
func WithTimeout(timeout time.Duration) ServerOption
type Transport ¶
type Transport struct {
// contains filtered or unexported fields
}
Transport is an HTTP transport.
func (*Transport) PathTemplate ¶
PathTemplate returns the http path template.
func (*Transport) ReplyHeader ¶
ReplyHeader returns the reply header.
func (*Transport) RequestHeader ¶
RequestHeader returns the request header.
type Transporter ¶
type Transporter interface { transport.Transporter Request() *http.Request PathTemplate() string }
Transporter is http Transporter