Documentation
¶
Index ¶
- Constants
- func NewCustomHttpClient(opts ...TransportOpt) *http.Client
- func NewCustomTransport(opts ...TransportOpt) http.RoundTripper
- type Client
- func (c *Client) Get(ctx context.Context, address string, data map[string]any) ([]byte, int, error)
- func (c *Client) Post(ctx context.Context, address string, data map[string]any) ([]byte, int, error)
- func (c *Client) Put(ctx context.Context, address string, data map[string]any) ([]byte, int, error)
- type CustomTransport
- type HandlerFunc
- type Opt
- type Server
- type TransportOpt
Constants ¶
View Source
const (
StatusCreated = http.StatusCreated
)
Variables ¶
This section is empty.
Functions ¶
func NewCustomHttpClient ¶
func NewCustomHttpClient(opts ...TransportOpt) *http.Client
func NewCustomTransport ¶
func NewCustomTransport(opts ...TransportOpt) http.RoundTripper
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
type CustomTransport ¶
type HandlerFunc ¶
type Opt ¶
type Opt func(c *Client)
func SetBasicAuth ¶
func SetContentType ¶
func SetHttpClient ¶
func SetTimeout ¶
SetTimeout The request timeout ,Not client timeout The lifecycle is within one request, not throughout the entire client
type Server ¶
type Server struct {
// contains filtered or unexported fields
}
func NewHttp ¶
func NewHttp(serverName, address string, port int, handlerFunc HandlerFunc) *Server
NewHttp 构造函数
func (*Server) ServiceInstance ¶
func (s *Server) ServiceInstance() *register.ServiceInstance
ServiceInstance 获取服务实例(服务注册与发现)
type TransportOpt ¶
type TransportOpt func(c *CustomTransport)
func Handle ¶
func Handle(handle func(req *http.Request, requestBytes, responseBytes []byte, err error)) TransportOpt
func Logger ¶
func Logger(logger io.Writer) TransportOpt
func Name ¶
func Name(name string) TransportOpt
Click to show internal directories.
Click to hide internal directories.