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.
weishi/request.go

32 lines
525 B

2 years ago
package weishi
2 years ago
import (
"context"
"go.dtapp.net/gorequest"
)
2 years ago
2 years ago
func (c *Client) request(ctx context.Context, url string) (gorequest.Response, error) {
2 years ago
// 创建请求
4 months ago
client := gorequest.NewHttp()
2 years ago
// 设置请求地址
client.SetUri(url)
// 设置用户代理
2 years ago
client.SetUserAgent(c.config.ua)
2 years ago
// 发起请求
2 years ago
request, err := client.Get(ctx)
2 years ago
if err != nil {
return gorequest.Response{}, err
}
2 years ago
// 记录日志
4 months ago
if c.gormLog.status {
go c.gormLog.client.Middleware(ctx, request)
2 years ago
}
return request, err
}