httputils

package
v0.414.0 Latest Latest
Warning

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

Go to latest
Published: Jul 28, 2025 License: Apache-2.0 Imports: 21 Imported by: 0

README

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DownloadAsFile added in v0.343.0

func DownloadAsFile(ctx context.Context, options *httputilsparameteroptions.DownloadAsFileOptions) (downloadedFile filesinterfaces.File, err error)

func GenerateCertAndKeyForTestWebserver added in v0.314.0

func GenerateCertAndKeyForTestWebserver(ctx context.Context) (certAndKeyPair *x509utils.X509CertKeyPair, err error)

func GetNativeClient

func GetNativeClient() (client httputilsinterfaces.Client)

Get the HTTP client written using native go http implementation.

This is the default client to use when sending request from your running machine.

func GetProgressEveryNBytes added in v0.343.0

func GetProgressEveryNBytes(ctx context.Context) int

func GetTestWebServer

func GetTestWebServer(port int) (webServer httputilsinterfaces.Server, err error)

func GetTlsTestWebServer

func GetTlsTestWebServer(ctx context.Context, port int) (webServer httputilsinterfaces.Server, err error)

func SendRequest added in v0.314.0

func SendRequestAndGetBodyAsString

func SendRequestAndGetBodyAsString(ctx context.Context, requestOptions *httputilsparameteroptions.RequestOptions) (response string, err error)

func WithDownloadProgressEveryNBytes added in v0.343.0

func WithDownloadProgressEveryNBytes(ctx context.Context, nBytes int) context.Context

func WithDownloadProgressEveryNMBytes added in v0.343.0

func WithDownloadProgressEveryNMBytes(ctx context.Context, nMBytes int) context.Context

func WithDownloadProgressEveryNkBytes added in v0.343.0

func WithDownloadProgressEveryNkBytes(ctx context.Context, nkBytes int) context.Context

Types

type NativeClient

type NativeClient struct {
}

HTTP client written using native go http implementation.

func NewNativeClient

func NewNativeClient() (n *NativeClient)

func (*NativeClient) DownloadAsFile

func (n *NativeClient) DownloadAsFile(ctx context.Context, downloadOptions *httputilsparameteroptions.DownloadAsFileOptions) (downloadedFile filesinterfaces.File, err error)

func (*NativeClient) DownloadAsTemporaryFile

func (n *NativeClient) DownloadAsTemporaryFile(ctx context.Context, downloadOptions *httputilsparameteroptions.DownloadAsFileOptions) (downloadedFile filesinterfaces.File, err error)

func (*NativeClient) SendRequest

func (c *NativeClient) SendRequest(ctx context.Context, requestOptions *httputilsparameteroptions.RequestOptions) (response httputilsinterfaces.Response, err error)

func (*NativeClient) SendRequestAndGetBodyAsString

func (c *NativeClient) SendRequestAndGetBodyAsString(ctx context.Context, requestOptions *httputilsparameteroptions.RequestOptions) (responseBody string, err error)

func (*NativeClient) SendRequestAndRunYqQueryAgainstBody

func (c *NativeClient) SendRequestAndRunYqQueryAgainstBody(ctx context.Context, requestOptions *httputilsparameteroptions.RequestOptions, query string) (result string, err error)

type TestWebServer

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

A simple webserver mostly used for testing.

func NewTestWebServer

func NewTestWebServer() (t *TestWebServer)

func (*TestWebServer) GetMux

func (t *TestWebServer) GetMux() (mux *http.ServeMux, err error)

func (*TestWebServer) GetPort

func (t *TestWebServer) GetPort() (port int, err error)

func (*TestWebServer) GetServer

func (t *TestWebServer) GetServer() (server *http.Server, err error)

func (*TestWebServer) GetTlsCert

func (t *TestWebServer) GetTlsCert() (cert *x509.Certificate, err error)

func (*TestWebServer) GetWebServerWaitGroup

func (t *TestWebServer) GetWebServerWaitGroup() (webServerWaitGroup *sync.WaitGroup, err error)

func (*TestWebServer) SetMux

func (t *TestWebServer) SetMux(mux *http.ServeMux) (err error)

func (*TestWebServer) SetPort

func (t *TestWebServer) SetPort(port int) (err error)

func (*TestWebServer) SetServer

func (t *TestWebServer) SetServer(server *http.Server) (err error)

func (*TestWebServer) SetTlsCertAndKey

func (t *TestWebServer) SetTlsCertAndKey(ctx context.Context, certAndKey *x509utils.X509CertKeyPair) (err error)

func (*TestWebServer) SetWebServerWaitGroup

func (t *TestWebServer) SetWebServerWaitGroup(webServerWaitGroup *sync.WaitGroup) (err error)

func (*TestWebServer) StartInBackground

func (t *TestWebServer) StartInBackground(ctx context.Context) (err error)

func (*TestWebServer) Stop

func (t *TestWebServer) Stop(ctx context.Context) (err error)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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