request

package
v1.4.1 Latest Latest
Warning

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

Go to latest
Published: Mar 10, 2026 License: MIT Imports: 9 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Delete added in v1.3.7

func Delete(url string, headers *Headers) (json.RawMessage, error)

Delete sends an HTTP DELETE request to the specified URL with context support. Applies headers and returns the response body as json.RawMessage. Returns an error if the request or response processing fails.

func Get

func Get(url string, headers *Headers) (json.RawMessage, error)

Get sends an HTTP GET request to the specified URL with context support. Applies headers and returns the response body as json.RawMessage. Returns an error if the request or response processing fails.

func Post

func Post(url string, body any, headers *Headers) (json.RawMessage, error)

Post sends an HTTP POST request with a JSON body to the specified URL with context support. Applies headers and returns the response body as json.RawMessage. Returns an error if the request or response processing fails.

func Put added in v1.3.7

func Put(url string, body any, headers *Headers) (json.RawMessage, error)

Put sends an HTTP PUT request with a JSON body to the specified URL with context support. Applies headers and returns the response body as json.RawMessage. Returns an error if the request or response processing fails.

Types

type Headers

type Headers map[string]string

Headers type alias for map[string]string to store HTTP headers.

type RequestConfig added in v1.3.7

type RequestConfig struct {
	Timeout    time.Duration // Timeout specifies the maximum time for the entire request
	MaxRetries int           // MaxRetries specifies maximum retry attempts for failed requests
	RetryDelay time.Duration // RetryDelay specifies the delay between retry attempts
}

RequestConfig holds configuration parameters for HTTP requests. This struct centralizes all request settings for better maintainability.

func LoadConfig added in v1.3.7

func LoadConfig() RequestConfig

LoadConfig loads request configuration with defaults. Returns a RequestConfig struct with default values.

Jump to

Keyboard shortcuts

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