Documentation
¶
Index ¶
- func RandomString() string
- func SanitizeCookieName(n string) string
- func SanitizeCookieValue(v string, quoted bool) string
- type BasicAuth
- type ClientOption
- func WithBaseURL(baseURL string) ClientOption
- func WithCookieJar(jar http.CookieJar) ClientOption
- func WithFollowRedirects(followRedirects bool, maxRedirects int) ClientOption
- func WithLogger(logger resty.Logger) ClientOption
- func WithProxy(proxy string) ClientOption
- func WithTLSClientConfig(config *tls.Config) ClientOption
- func WithTimeout(timeout time.Duration) ClientOption
- func WithTransport(transport http.RoundTripper) ClientOption
- type HTTPClient
- func (c *HTTPClient) Close() error
- func (c *HTTPClient) Delete(url string, options *Options) (*Response, error)
- func (c *HTTPClient) Get(url string, options *Options) (*Response, error)
- func (c *HTTPClient) Head(url string, options *Options) (*Response, error)
- func (c *HTTPClient) Options(url string, options *Options) (*Response, error)
- func (c *HTTPClient) Patch(url string, options *Options) (*Response, error)
- func (c *HTTPClient) Post(url string, options *Options) (*Response, error)
- func (c *HTTPClient) Put(url string, options *Options) (*Response, error)
- func (c *HTTPClient) Request(ctx context.Context, method, url string, options *Options) (*Response, error)
- type Multipart
- type Options
- type Response
- type Transport
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func RandomString ¶
func RandomString() string
func SanitizeCookieName ¶
func SanitizeCookieValue ¶
sanitizeCookieValue produces a suitable cookie-value from v. It receives a quoted bool indicating whether the value was originally quoted. https://tools.ietf.org/html/rfc6265#section-4.1.1
cookie-value = *cookie-octet / ( DQUOTE *cookie-octet DQUOTE )
cookie-octet = %x21 / %x23-2B / %x2D-3A / %x3C-5B / %x5D-7E
; US-ASCII characters excluding CTLs,
; whitespace DQUOTE, comma, semicolon,
; and backslash
We loosen this as spaces and commas are common in cookie values thus we produce a quoted cookie-value if v contains commas or spaces. See https://golang.org/issue/7243 for the discussion.
Types ¶
type ClientOption ¶
type ClientOption func(*clientOptions)
Option defines the configuration function type for request options
func WithBaseURL ¶
func WithBaseURL(baseURL string) ClientOption
func WithFollowRedirects ¶
func WithFollowRedirects(followRedirects bool, maxRedirects int) ClientOption
func WithLogger ¶
func WithLogger(logger resty.Logger) ClientOption
func WithTLSClientConfig ¶
func WithTLSClientConfig(config *tls.Config) ClientOption
WithTLSClientConfig sets SSL/TLS options
func WithTimeout ¶
func WithTimeout(timeout time.Duration) ClientOption
WithTimeout sets the timeout duration
func WithTransport ¶
func WithTransport(transport http.RoundTripper) ClientOption
type HTTPClient ¶
type HTTPClient struct {
// contains filtered or unexported fields
}
func NewHTTPClient ¶
func NewHTTPClient(options ...ClientOption) *HTTPClient
func (*HTTPClient) Close ¶
func (c *HTTPClient) Close() error
func (*HTTPClient) Delete ¶
func (c *HTTPClient) Delete(url string, options *Options) (*Response, error)
Delete sends a DELETE request
func (*HTTPClient) Get ¶
func (c *HTTPClient) Get(url string, options *Options) (*Response, error)
Get sends a GET request
func (*HTTPClient) Head ¶
func (c *HTTPClient) Head(url string, options *Options) (*Response, error)
Head sends a HEAD request
func (*HTTPClient) Options ¶
func (c *HTTPClient) Options(url string, options *Options) (*Response, error)
Options sends an OPTIONS request
func (*HTTPClient) Patch ¶
func (c *HTTPClient) Patch(url string, options *Options) (*Response, error)
Patch sends a PATCH request
func (*HTTPClient) Post ¶
func (c *HTTPClient) Post(url string, options *Options) (*Response, error)
Post sends a POST request
type Transport ¶
type Transport struct {
// contains filtered or unexported fields
}
Transport implements an HTTP transport that supports both standard HTTP/HTTPS and HTTP/3 (QUIC) protocols. It handles alternative services (Alt-Svc) for protocol negotiation and connection upgrades.
func NewTransport ¶
NewTransport creates a new Transport instance with the specified TLS and QUIC configurations