Documentation ¶
Overview ¶
Package http provides http client and server implementations.
Package http provides http client and server implementations.
Index ¶
- type Response
- type Server
- func (this *Server) RegisterHandler(path, method string, handler http.Handler)
- func (this *Server) RegisterHandlerFunc(path, method string, handlerFunc http.HandlerFunc)
- func (this *Server) RegisterPathPrefixHandler(prefix string, handler http.Handler)
- func (this *Server) RegisterPathPrefixHandlerFunc(prefix string, handlerFunc http.HandlerFunc)
- func (this *Server) SetRouter(router *mux.Router)
- func (this *Server) Start(address string, listenAndServeFailureFunc func(err error), ...) error
- func (this *Server) Stop(shutdownTimeout time.Duration) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Response ¶
Response is response information.
func Request ¶
func Request(url, method string, header map[string][]string, body string, timeout time.Duration, username, password string, transport *http.Transport) (Response, error)
Request is request.
ex) response, err := http.Request("http://127.0.0.1:10000/test/id-01", http.MethodGet, map[string][]string{"header-1": {"value-1"}}, "", 10, "", "", nil)
type Server ¶
type Server struct {
// contains filtered or unexported fields
}
Server is a struct that provides server related methods.
func (*Server) RegisterHandler ¶ added in v1.1.8
RegisterHandler is add handler.
ex) server.RegisterHandler("/xxx", http.MethodPost, handler)
func (*Server) RegisterHandlerFunc ¶ added in v1.1.6
func (this *Server) RegisterHandlerFunc(path, method string, handlerFunc http.HandlerFunc)
RegisterHandlerFunc is add handler function.
ex) server.RegisterHandlerFunc("/xxx", http.MethodPost, handlerFunc)
func (*Server) RegisterPathPrefixHandler ¶ added in v1.1.6
RegisterPathPrefixHandler is add path prefix handler.
ex) server.RegisterPathPrefixHandler("xxx", handler)
func (*Server) RegisterPathPrefixHandlerFunc ¶ added in v1.1.8
func (this *Server) RegisterPathPrefixHandlerFunc(prefix string, handlerFunc http.HandlerFunc)
RegisterPathPrefixHandlerFunc is add path prefix handler function.
ex) server.RegisterPathPrefixHandlerFunc("xxx", Func)