feat: 支持自定义请求 header

This commit is contained in:
Mmx233
2023-12-03 20:34:57 +08:00
parent 605637e8cb
commit 59bf13467b
2 changed files with 36 additions and 11 deletions

View File

@@ -12,15 +12,21 @@ type Conf struct {
//调用 API 时直接访问 https URL
Https bool
//登录参数,不可缺省
LoginInfo LoginInfo
Client *http.Client
LoginInfo LoginInfo
Client *http.Client
CustomHeader map[string]interface{}
}
func New(conf *Conf) *Srun {
srun := &Srun{
LoginInfo: conf.LoginInfo,
}
srun.api.Init(conf.Https, conf.LoginInfo.Form.Domain, conf.Client)
srun.api.Init(&ApiConfig{
Https: conf.Https,
Domain: conf.LoginInfo.Form.Domain,
Client: conf.Client,
CustomHeader: conf.CustomHeader,
})
return srun
}