webhook

package
v1.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 13, 2022 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Webhook

type Webhook struct {
	// contains filtered or unexported fields
}

Notifier implements a Notifier for generic webhooks.

func New

func New(conf *WebhookConfig) (*Webhook, error)

New returns a new Webhook.

func (*Webhook) Drain

func (w *Webhook) Drain(r *http.Response)

Drain consumes and closes the response's body to make sure that the HTTP client can reuse existing connections.

func (*Webhook) PostJSON

func (w *Webhook) PostJSON(ctx context.Context, url string, body io.Reader) (*http.Response, error)

PostJSON sends a POST request with JSON payload to the given URL.

func (*Webhook) PostText

func (w *Webhook) PostText(ctx context.Context, url string, body io.Reader) (*http.Response, error)

PostText sends a POST request with text payload to the given URL.

type WebhookConfig

type WebhookConfig struct {
	commoncfg.HTTPClientConfig

	AdditionalHeaders map[string]string `yaml:"additional_headers,omitempty"`
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL