You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
go-library/service/weishi/request.go

32 lines
535 B

package weishi
2 years ago
import (
"context"
"github.com/dtapps/go-library/utils/gorequest"
)
2 years ago
func (c *Client) request(ctx context.Context, url string) (gorequest.Response, error) {
// 创建请求
2 years ago
client := c.requestClient
// 设置请求地址
client.SetUri(url)
// 设置用户代理
2 years ago
client.SetUserAgent(c.config.ua)
// 发起请求
2 years ago
request, err := client.Get(ctx)
if err != nil {
return gorequest.Response{}, err
}
2 years ago
// 记录日志
1 year ago
if c.zap.status {
go c.zap.client.Middleware(ctx, request)
2 years ago
}
return request, err
}