httpClient

package
v0.0.0-...-a7dfda7 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 13, 2023 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ConnectionSession

type ConnectionSession struct {
	Session *http.Client // 执行http请求
	User    string       // 用于身份验证的用户名
	Pass    string       // 用于身份验证的密码
	Url     string       // 请求的url
}

ConnectionSession 与服务器的连接回话

func NewConnectionSession

func NewConnectionSession(user, pass, url string) *ConnectionSession

NewConnectionSession 创建一个新的连接会话 如果已经存在连接会话,则返回现有的连接会话,如果没有则创建一个新的连接会话

func (*ConnectionSession) Close

func (c *ConnectionSession) Close()

Close 关闭连接会话

func (*ConnectionSession) HttpGetRequest

func (c *ConnectionSession) HttpGetRequest(requestUrl string, headers map[string]string, params map[string]interface{}) (string, error)

HttpGetRequest 发起一个http的Get请求,并返回响应主题作为字符串 requestUrl: 请求链接 headers: 请求头 params: 请求参数

func (*ConnectionSession) ParseUrl

func (c *ConnectionSession) ParseUrl() (*url.URL, error)

ParseUrl 解析url

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL