Documentation ¶
Index ¶
- type Client
- type HTTPClient
- type NopRSCloser
- func (instance NopRSCloser) Close() error
- func (instance NopRSCloser) GetContentLength() int64
- func (instance NopRSCloser) Read(p []byte) (n int, err error)
- func (instance NopRSCloser) Seek(offset int64, whence int) (int64, error)
- func (instance NopRSCloser) SetContentLength(size int64)
- func (instance NopRSCloser) SetFirstFakeChunk()
- type Option
- func WithContentLength(s int64) Option
- func WithContext(c context.Context) Option
- func WithEndpoint(endpoint string) Option
- func WithHeader(header http.Header) Option
- func WithTPSLimit(token string, tps float64, burst int) Option
- func WithTimeout(t time.Duration) Option
- func WithoutHeader(header []string) Option
- type Response
- type TPSLimiter
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type HTTPClient ¶
type HTTPClient struct {
// contains filtered or unexported fields
}
HTTPClient 实现 Client 接口
type NopRSCloser ¶
type NopRSCloser struct {
// contains filtered or unexported fields
}
NopRSCloser 实现不完整seeker
func (NopRSCloser) GetContentLength ¶ added in v0.0.3
func (instance NopRSCloser) GetContentLength() int64
GetContentLength 获取数据流大小
func (NopRSCloser) Read ¶
func (instance NopRSCloser) Read(p []byte) (n int, err error)
Read 实现 NopRSCloser reader
func (NopRSCloser) Seek ¶
func (instance NopRSCloser) Seek(offset int64, whence int) (int64, error)
Seek 实现 NopRSCloser seeker, 只实现seek开头/结尾以便http.ServeContent用于确定正文大小
func (NopRSCloser) SetContentLength ¶
func (instance NopRSCloser) SetContentLength(size int64)
SetContentLength 设置数据流大小
func (NopRSCloser) SetFirstFakeChunk ¶
func (instance NopRSCloser) SetFirstFakeChunk()
SetFirstFakeChunk 开启第一次read返回空数据 TODO 测试
type Option ¶
type Option interface {
// contains filtered or unexported methods
}
Option 发送请求的额外设置
func WithTPSLimit ¶
WithTPSLimit 请求时使用全局流量限制
type Response ¶
Response 请求的响应或错误信息
func (*Response) CheckHTTPResponse ¶
CheckHTTPResponse 检查请求响应HTTP状态码
func (*Response) GetRSCloser ¶
func (resp *Response) GetRSCloser() (*NopRSCloser, error)
GetRSCloser 返回带有空seeker的RSCloser,供http.ServeContent使用
func (*Response) GetResponse ¶
GetResponse 检查响应并获取响应正文
type TPSLimiter ¶
func NewTPSLimiter ¶
func NewTPSLimiter() TPSLimiter
Click to show internal directories.
Click to hide internal directories.