Documentation ¶
Index ¶
- Variables
- func CheckCondition(validator model.WebhookConditionValidator, filter string) func(ctx context.Context, payload interface{}) (bool, error)
- func CheckConditionFilter(validator model.WebhookConditionValidator, filter string) error
- func ComposeMiddleware[A any](handler func(A) error, middleware ...func(next func(A) error) func(A) error) func(A) error
- func Do(client *http.Client, req *http.Request, ops ...OpResponseMiddleware) error
- func FromJson[T any](out *T) func(next OpResponse) OpResponse
- func GetBody(w io.Writer) func(next OpResponse) OpResponse
- func NewClient() *http.Client
- func NewRequest(ctx context.Context, method string, url string, ops ...OpRequestMiddleware) (*http.Request, error)
- func SetBody(r_ io.Reader) func(next OpRequest) OpRequest
- func SetHeader(header http.Header) func(next OpRequest) OpRequest
- func SetQuery(query url.Values) func(next OpRequest) OpRequest
- func SetTransport(client *http.Client, opts ...OpTransport) *http.Client
- func ToJson[T any](in T) func(next OpRequest) OpRequest
- type Config
- type OpRequest
- type OpRequestMiddleware
- type OpResponse
- type OpResponseMiddleware
- type OpTransport
- type Pool
Constants ¶
This section is empty.
Variables ¶
View Source
var ( SetContentEncoding_GZIP = setHeader(http.Header{"Content-Encoding": []string{"gzip"}}) SetContentType_Json = setHeader(http.Header{"Content-Type": []string{"application/json"}}) SetAccept_Json = setHeader(http.Header{"Accept": []string{"application/json"}}) SetAccept_Plain = setHeader(http.Header{"Accept": []string{"text/plain"}}) )
View Source
var DefaultClient = func() func() *http.Client { client := http.DefaultClient SetTransport(client, func(t *http.Transport) { t.Proxy = http.ProxyFromEnvironment t.DialContext = (&net.Dialer{ Timeout: 30 * time.Second, KeepAlive: 30 * time.Second, DualStack: true, }).DialContext t.MaxIdleConns = 100 t.IdleConnTimeout = 90 * time.Second t.TLSHandshakeTimeout = 10 * time.Second t.ExpectContinueTimeout = 1 * time.Second t.MaxIdleConnsPerHost = runtime.GOMAXPROCS(0) + 1 t.TLSClientConfig.InsecureSkipVerify = true }) return func() *http.Client { return client } }()
View Source
var GZipWriter = NewPool(func() *gzip.Writer { w, _ := gzip.NewWriterLevel(nil, gzip.BestCompression) return w })
Functions ¶
func CheckCondition ¶
func CheckConditionFilter ¶
func CheckConditionFilter(validator model.WebhookConditionValidator, filter string) error
func ComposeMiddleware ¶
func FromJson ¶
func FromJson[T any](out *T) func(next OpResponse) OpResponse
func GetBody ¶
func GetBody(w io.Writer) func(next OpResponse) OpResponse
func NewRequest ¶
func SetTransport ¶
func SetTransport(client *http.Client, opts ...OpTransport) *http.Client
Types ¶
type Config ¶
type OpRequest ¶
func Compress_GZip ¶
type OpRequestMiddleware ¶
type OpResponse ¶
func CheckStatus ¶
func CheckStatus(next OpResponse) OpResponse
type OpResponseMiddleware ¶
type OpResponseMiddleware = func(next OpResponse) OpResponse
type OpTransport ¶
Click to show internal directories.
Click to hide internal directories.