http

package
v0.38.1 Latest Latest
Warning

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

Go to latest
Published: Apr 15, 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) (*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(*Opts) 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 WithTLSCA added in v0.37.0

func WithTLSCA(tlsCACert []byte) Option

func WithTLSCert added in v0.37.0

func WithTLSCert(tlsCert []byte) Option

func WithTLSEnabled added in v0.37.0

func WithTLSEnabled(tlsEnabled bool) Option

func WithTLSKey added in v0.37.0

func WithTLSKey(tlsKey []byte) Option

func WithTimeout

func WithTimeout(timeout time.Duration) Option

func WithVersion

func WithVersion(version string) Option

type Opts added in v0.37.0

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

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, statusCode int, v any)

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
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy