http

package
v1.0.1 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BodyBytes

func BodyBytes(ctx context.Context, response *http.Response) ([]byte, error)

func Fetch

func Fetch[T interface{}](ctx context.Context, url, method string, payload interface{}, options ...FetchOptions) (T, error)

func FetchData

func FetchData(ctx context.Context, apiURL, method, stage string, headers *http.Header, responseType string) (string, error)

func FetchRaw

func FetchRaw(ctx context.Context, uri, method string, payload interface{}, options ...FetchOptions) (*http.Response, error)

func JsonBody

func JsonBody[T interface{}](ctx context.Context, response *http.Response) (T, error)

func TextBody

func TextBody(ctx context.Context, response *http.Response) (string, error)

Types

type FetchOptions

type FetchOptions struct {
	Headers   *http.Header
	Cookies   *[]http.Cookie
	Proxy     *Proxy
	ShowCurl  bool
	RawBody   bool
	CookieJar *cookiejar.Jar
}

type Proxy

type Proxy struct {
	Host         string
	Port         string
	Username     string
	Password     string
	AssignedIp   string
	AssignedPort string
}

Jump to

Keyboard shortcuts

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