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) AddHandler(path, method string, handler func(http.ResponseWriter, *http.Request))
- func (this *Server) AddPathPrefixHandler(prefix string, handler http.Handler)
- func (this *Server) SetRouter(router *mux.Router)
- func (this *Server) Start(address string, listenAndServeFailureFunc func(err error), ...) error
- func (this *Server) Stop(shutdownTimeout uint64) 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 int, username, password string) (Response, error)
Request is request.
ex) response, err := http.Request("http://127.0.0.1:10000/test/id-01", net_http.MethodGet, map[string][]string{"header-1": {"value-1"}}, "", 3, "", "")
type Server ¶
type Server struct {
// contains filtered or unexported fields
}
Server is a struct that provides server related methods.
func (*Server) AddHandler ¶
func (this *Server) AddHandler(path, method string, handler func(http.ResponseWriter, *http.Request))
AddHandler is add handler.
ex) server.AddHandler("/v1/test", http.MethodPost, handler)
func (*Server) AddPathPrefixHandler ¶
AddPathPrefixHandler is add path prefix handler.
ex) server.AddPathPrefixHandler("/swagger/", httpSwagger.WrapHandler)
Click to show internal directories.
Click to hide internal directories.