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.
35 lines
611 B
35 lines
611 B
package weishi
|
|
|
|
import (
|
|
"context"
|
|
"go.dtapp.net/gorequest"
|
|
)
|
|
|
|
func (c *Client) request(ctx context.Context, url string) (gorequest.Response, error) {
|
|
|
|
// 创建请求
|
|
client := c.requestClient
|
|
|
|
// 设置请求地址
|
|
client.SetUri(url)
|
|
|
|
// 设置用户代理
|
|
client.SetUserAgent(c.config.ua)
|
|
|
|
// 发起请求
|
|
request, err := client.Get(ctx)
|
|
if err != nil {
|
|
return gorequest.Response{}, err
|
|
}
|
|
|
|
// 日志
|
|
if c.log.gorm {
|
|
go c.log.logGormClient.GormMiddleware(ctx, request, Version)
|
|
}
|
|
if c.log.mongo {
|
|
go c.log.logMongoClient.MongoMiddleware(ctx, request, Version)
|
|
}
|
|
|
|
return request, err
|
|
}
|