代码拉取完成,页面将自动刷新
package https
import (
"context"
"time"
)
// 声明URL请求结构信息
//
// url 要请求的网址信息
// opts 可选参数,针对此网址进行的配置项追加
func New(url string, opts ...OptionFunc) *CURL {
// 默认配置项加载
opt := Option{
time_out: _default.timeOut,
cache_time: _default.cacheTime,
jar: getJar(),
context: context.TODO(),
}
// 配置项设置
for i := 0; i < len(opts); i++ {
opts[i](&opt)
}
// 声明配置项的值
return &CURL{
Uri: url,
option: &opt,
CreateTime: time.Now(),
}
}
// 设置Option选项[此参数需要在Get/Post/PostJson之前进行调用,若在之后调用的话会失去作用]
//
// opts 可选参数,针对此网址进行的配置项追加
func (c *CURL) WithOption(opts ...OptionFunc) *CURL {
// 配置项设置
for i := 0; i < len(opts); i++ {
opts[i](c.option)
}
return c
}
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。