http

package
v0.1.2-rc0 Latest Latest
Warning

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

Go to latest
Published: Oct 10, 2024 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const DefaultContentType = "application/json; charset=utf-8"
View Source
const DefaultHTTPMethod = "POST"
View Source
const DefaultUserAgent = "falco-talon"

Variables

View Source
var ErrClientAuthenticationError = errors.New("authentication error") // ErrClientAuthenticationError = 401
View Source
var ErrForbidden = errors.New("access denied") // ErrForbidden = 403
View Source
var ErrHeaderMissing = errors.New("header missing") // ErrHeaderMissing = 400
View Source
var ErrNotFound = errors.New("resource not found") // ErrNotFound = 404
View Source
var ErrTooManyRequest = errors.New("exceeding post rate limit") // ErrTooManyRequest = 429
View Source
var ErrUnprocessableEntityError = errors.New("wrong request") // ErrUnprocessableEntityError = 422

Functions

func CheckURL

func CheckURL(u string) error

Types

type Client

type Client struct {
	Headers    http.Header
	HTTPMethod string
	Compressed bool
}

func DefaultClient

func DefaultClient() Client

func NewClient

func NewClient(httpMethod, contentType, userAgent string, headers map[string]string) Client

func (*Client) DeleteHeader

func (c *Client) DeleteHeader(key string)

func (*Client) Request

func (c *Client) Request(u string, payload any) error

func (*Client) SetBasicAuth

func (c *Client) SetBasicAuth(user, password string)

func (*Client) SetContentType

func (c *Client) SetContentType(ct string)

func (*Client) SetHTTPMethod

func (c *Client) SetHTTPMethod(hm string)

func (*Client) SetHeader

func (c *Client) SetHeader(key, value string)

Jump to

Keyboard shortcuts

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