http

package
v25.10.2 Latest Latest
Warning

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

Go to latest
Published: Oct 28, 2025 License: MIT Imports: 17 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,
	rawQuery *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, rawQuery *string) (*http.Response, error)

func (*Client) NewRequestWithContext

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

func (*Client) Patch

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

func (*Client) Post

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

func (*Client) Put

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

func (*Client) Request

func (c *Client) Request(ctx context.Context, method string, path string, body interface{},
	query map[string]string, rawQuery *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(*Opts) error

func WithBasicAuth

func WithBasicAuth(username, password string) Option

func WithHTTPClient

func WithHTTPClient(httpClient *http.Client) Option

func WithKubernetesAuth

func WithKubernetesAuth(serviceAccountPath string) Option

func WithLogger

func WithLogger(logger *logr.Logger) Option

func WithTLSCA

func WithTLSCA(tlsCACert []byte) Option

func WithTLSCert

func WithTLSCert(tlsCert []byte) Option

func WithTLSEnabled

func WithTLSEnabled(tlsEnabled bool) Option

func WithTLSKey

func WithTLSKey(tlsKey []byte) Option

func WithTimeout

func WithTimeout(timeout time.Duration) Option

func WithVersion

func WithVersion(version string) Option

type Opts

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

type ResponseWriter

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

func NewResponseWriter

func NewResponseWriter(logger *logr.Logger) *ResponseWriter

func (*ResponseWriter) Write

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

func (*ResponseWriter) WriteError

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

func (*ResponseWriter) WriteErrorf

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

func (*ResponseWriter) WriteOK

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