Documentation ¶
Index ¶
- Variables
- func CookieHandler(w http.ResponseWriter, req *http.Request)
- func IpInt2Str(i uint32) string
- func IpStr2Int(ipStr string) uint32
- func LoggingMiddleware(next http.Handler) http.Handler
- type ChiRouter
- type HttpClient
- func (c *HttpClient) Get(url string, header map[string]string) (*http.Response, error)
- func (c *HttpClient) PostFile(url string, header map[string]string, filePath string) (*http.Response, error)
- func (c *HttpClient) PostJson(url string, header map[string]string, body map[string]any) (*http.Response, error)
- func (c *HttpClient) Req(method, url string, header map[string]string, body io.Reader) (*http.Response, error)
- type HttpServer
- type Middleware
- type Option
Constants ¶
This section is empty.
Variables ¶
Functions ¶
func CookieHandler ¶
func CookieHandler(w http.ResponseWriter, req *http.Request)
Types ¶
type HttpClient ¶
func NewHttpClient ¶
func NewHttpClient() *HttpClient
func (*HttpClient) PostFile ¶
func (c *HttpClient) PostFile(url string, header map[string]string, filePath string) (*http.Response, error)
PostFile 一般是服务器发送响应才发送文件
type HttpServer ¶
type HttpServer struct {
// contains filtered or unexported fields
}
func New ¶
func New(router *http.ServeMux) *HttpServer
func NewWithOption ¶
func NewWithOption(router *http.ServeMux, option Option) *HttpServer
func (*HttpServer) HandleFunc ¶
func (s *HttpServer) HandleFunc(pattern string, handler func(http.ResponseWriter, *http.Request))
func (*HttpServer) Start ¶
func (s *HttpServer) Start()
func (*HttpServer) Stop ¶
func (s *HttpServer) Stop()
Click to show internal directories.
Click to hide internal directories.