http

package
v0.0.27 Latest Latest
Warning

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

Go to latest
Published: Mar 8, 2024 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewHeadersTransport

func NewHeadersTransport(rt http.RoundTripper, headers map[string]string) http.RoundTripper

Types

type Client

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

func NewClient

func NewClient(baseUrl string, opts ...Option) (*Client, error)

func (*Client) Delete

func (c *Client) Delete(ctx context.Context, path string, body interface{}, query map[string]string) (*http.Response, error)

func (*Client) Do

func (c *Client) Do(req *http.Request) (*http.Response, error)

func (*Client) Get

func (c *Client) Get(ctx context.Context, path string, query map[string]string) (*http.Response, error)

func (*Client) NewRequestWithContext

func (c *Client) NewRequestWithContext(ctx context.Context, method string, path string, body interface{},
	query map[string]string) (*http.Request, error)

func (*Client) Patch

func (c *Client) Patch(ctx context.Context, path string, body interface{}, query map[string]string) (*http.Response, error)

func (*Client) Post

func (c *Client) Post(ctx context.Context, path string, body interface{}, query map[string]string) (*http.Response, error)

func (*Client) Put

func (c *Client) Put(ctx context.Context, path string, body interface{}, query map[string]string) (*http.Response, error)

func (*Client) Request

func (c *Client) Request(ctx context.Context, method string, path string, body interface{},
	query map[string]string) (*http.Response, error)

type HeadersTransport

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

func (*HeadersTransport) RoundTrip

func (t *HeadersTransport) RoundTrip(req *http.Request) (*http.Response, error)

type Option

type Option func(*Client) error

func WithBasicAuth

func WithBasicAuth(username, password string) Option

func WithHTTPClient

func WithHTTPClient(httpClient *http.Client) Option

func WithKubernetesAuth added in v0.0.26

func WithKubernetesAuth(serviceAccountPath string) Option

func WithLogger

func WithLogger(logger *logr.Logger) Option

func WithTimeout

func WithTimeout(timeout time.Duration) Option

func WithVersion

func WithVersion(version string) Option

type ResponseWriter added in v0.0.26

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

func NewResponseWriter added in v0.0.26

func NewResponseWriter(logger *logr.Logger) *ResponseWriter

func (*ResponseWriter) Write added in v0.0.26

func (r *ResponseWriter) Write(w http.ResponseWriter, v any, statusCode int)

func (*ResponseWriter) WriteError added in v0.0.26

func (r *ResponseWriter) WriteError(w http.ResponseWriter, msg string)

func (*ResponseWriter) WriteErrorf added in v0.0.26

func (r *ResponseWriter) WriteErrorf(w http.ResponseWriter, format string, a ...any)

func (*ResponseWriter) WriteOK added in v0.0.26

func (r *ResponseWriter) WriteOK(w http.ResponseWriter, v any)

Jump to

Keyboard shortcuts

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