Documentation
¶
Index ¶
- func Download(originURL, filePath string) (int64, error)
- func DownloadCtx(ctx context.Context, originURL, filePath string) (int64, error)
- type Option
- func WithBasicAuth(username, password string) Option
- func WithBearerTokenAuth(token string) Option
- func WithClient(client *http.Client) Option
- func WithContext(ctx context.Context) Option
- func WithHeader(headers ...map[string]string) Option
- func WithSkipTLS() Option
- func WithTimeout(t time.Duration) Option
- func WithTransport(tr http.RoundTripper) Option
- type Request
- func (r *Request) Download(originURL, filePath string) (int64, error)
- func (r *Request) DownloadToWriter(originURL string, w io.Writer) (int64, error)
- func (r Request) Request() *http.Request
- func (r Request) Response() *http.Response
- func (r *Request) SetBasicAuth(username, password string)
- func (r *Request) SetBearerTokenAuth(token string)
- func (r *Request) SetClient(client *http.Client)
- func (r *Request) SetContext(ctx context.Context)
- func (r *Request) SetHeader(header map[string]string)
- func (r *Request) SetSkipTLS()
- func (r *Request) SetTimeout(t time.Duration)
- func (r *Request) SetTransport(rt http.RoundTripper)
- func (r Request) Status() (int, string)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Option ¶
type Option func(*Request)
func WithBasicAuth ¶
func WithBearerTokenAuth ¶
func WithClient ¶
func WithContext ¶
func WithHeader ¶
func WithSkipTLS ¶
func WithSkipTLS() Option
func WithTimeout ¶
func WithTransport ¶
func WithTransport(tr http.RoundTripper) Option
type Request ¶
type Request struct {
// contains filtered or unexported fields
}
func NewRequest ¶
func (*Request) DownloadToWriter ¶
func (*Request) SetBasicAuth ¶
func (*Request) SetBearerTokenAuth ¶
func (*Request) SetContext ¶
func (*Request) SetSkipTLS ¶
func (r *Request) SetSkipTLS()
func (*Request) SetTimeout ¶
func (*Request) SetTransport ¶
func (r *Request) SetTransport(rt http.RoundTripper)
Click to show internal directories.
Click to hide internal directories.