github.com/qjfoidnh/BaiduPCS-Go@v0.0.0-20231011165705-caa18a3765f3/requester/requester.go (about)

     1  // Package requester 提供网络请求简便操作
     2  package requester
     3  
     4  const (
     5  	// DefaultUserAgent 默认浏览器标识
     6  	DefaultUserAgent = "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_13_2) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/63.0.3239.132 Safari/537.36"
     7  )
     8  
     9  var (
    10  	// UserAgent 浏览器标识
    11  	UserAgent = DefaultUserAgent
    12  	// DefaultClient 默认 http 客户端
    13  	DefaultClient = NewHTTPClient()
    14  )
    15  
    16  type (
    17  	// ContentTyper Content-Type 接口
    18  	ContentTyper interface {
    19  		ContentType() string
    20  	}
    21  
    22  	// ContentLengther Content-Length 接口
    23  	ContentLengther interface {
    24  		ContentLength() int64
    25  	}
    26  
    27  	// Event 下载/上传任务运行时事件
    28  	Event func()
    29  
    30  	// EventOnError 任务出错运行时事件
    31  	EventOnError func(err error)
    32  )