Documentation
¶
Index ¶
- func GetResponseMeta(w http.ResponseWriter) (status, size int)
- func HasContentType(r *http.Request, mimetypes ...string) bool
- func MustNewRequest(method, url string, body io.Reader, contentType string) *http.Request
- func NewChanHandler(buf int) (http.Handler, chan<- http.HandlerFunc)
- func NewRequestForm(method, url string, data url.Values) (*http.Request, error)
- func NewRequestJSON(method, url string, data interface{}) (*http.Request, error)
- func NewResilientClient(opts ...ResilientOptions) *retryablehttp.Client
- type CompressionRequestReader
- type ResilientOptions
- func ResilientClientWithClient(c *http.Client) ResilientOptions
- func ResilientClientWithConnectionTimeout(connTimeout time.Duration) ResilientOptions
- func ResilientClientWithLogger(l *logrusx.Logger) ResilientOptions
- func ResilientClientWithMaxRetry(retryMax int) ResilientOptions
- func ResilientClientWithMaxRetryWait(retryWaitMax time.Duration) ResilientOptions
- func ResilientClientWithMinxRetryWait(retryWaitMin time.Duration) ResilientOptions
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetResponseMeta ¶ added in v0.0.302
func GetResponseMeta(w http.ResponseWriter) (status, size int)
func HasContentType ¶ added in v0.0.81
HasContentType determines whether the request `content-type` includes a server-acceptable mime-type
Failure should yield an HTTP 415 (`http.StatusUnsupportedMediaType`)
func MustNewRequest ¶ added in v0.0.83
MustNewRequest returns a new *http.Request or fatals.
func NewChanHandler ¶ added in v0.0.297
func NewChanHandler(buf int) (http.Handler, chan<- http.HandlerFunc)
NewChanHandler returns a new handler and corresponding channel for sending handler funcs. Useful for testing. The argument buf specifies the channel capacity, so pass 0 for a sync handler.
func NewRequestForm ¶ added in v0.0.83
NewRequestForm returns a new POST Form *http.Request.
func NewRequestJSON ¶ added in v0.0.83
NewRequestJSON returns a new JSON *http.Request.
func NewResilientClient ¶ added in v0.0.204
func NewResilientClient(opts ...ResilientOptions) *retryablehttp.Client
Types ¶
type CompressionRequestReader ¶ added in v0.0.110
type CompressionRequestReader struct {
ErrHandler func(w http.ResponseWriter, r *http.Request, err error)
}
func NewCompressionRequestReader ¶ added in v0.0.110
func NewCompressionRequestReader(eh func(w http.ResponseWriter, r *http.Request, err error)) *CompressionRequestReader
func (*CompressionRequestReader) ServeHTTP ¶ added in v0.0.110
func (c *CompressionRequestReader) ServeHTTP(w http.ResponseWriter, r *http.Request, next http.HandlerFunc)
type ResilientOptions ¶ added in v0.0.204
type ResilientOptions func(o *resilientOptions)
func ResilientClientWithClient ¶ added in v0.0.204
func ResilientClientWithClient(c *http.Client) ResilientOptions
func ResilientClientWithConnectionTimeout ¶ added in v0.0.207
func ResilientClientWithConnectionTimeout(connTimeout time.Duration) ResilientOptions
func ResilientClientWithLogger ¶ added in v0.0.204
func ResilientClientWithLogger(l *logrusx.Logger) ResilientOptions
func ResilientClientWithMaxRetry ¶ added in v0.0.204
func ResilientClientWithMaxRetry(retryMax int) ResilientOptions
func ResilientClientWithMaxRetryWait ¶ added in v0.0.204
func ResilientClientWithMaxRetryWait(retryWaitMax time.Duration) ResilientOptions
func ResilientClientWithMinxRetryWait ¶ added in v0.0.204
func ResilientClientWithMinxRetryWait(retryWaitMin time.Duration) ResilientOptions
Click to show internal directories.
Click to hide internal directories.