[net/http]
:HTTP(HyperText Transfer Protocol,超文本传输协议
[客户端]
:Client
客户端
[Client]
// http.DefaultClient
func (c *Client) Get(url string) (r *Response, err error)
// bodyType => POST数据的资源类型(MIMEType)
func (c *Client) Post(url string, bodyType string, body io.Reader) (r *Response, err error)
// 标准编码格式为application/x-www-form-urlencoded的表单提交
func (c *Client) PostForm(url string, data url.Values) (r *Response, err error)
// 只请求目标 URL 的头部信息
func (c *Client) Head(url string) (r *Response, err error)
// 自定义请求格式
func (c *Client) Do(req *Request) (*Response, error)
服务端
[server]
// 开启一个HTTP,TCP 网络地址 addr 进行监听
func ListenAndServe(addr string, handler Handler) error
// Handler -> 服务器处理程序, 默认http.DefaultServeMux
// 处理HTTPS请求
func ListenAndServeTLS(addr string, certFile string, keyFile string, handler Handler) error