utils

package
v0.1.8 Latest Latest
Warning

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

Go to latest
Published: Nov 20, 2024 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DecodeResponse

func DecodeResponse(resp *http.Response, v interface{}) error

DecodeResponse decodes the response body into the provided interface

Types

type HTTPClient

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

HTTPClient wraps the standard http.Client with additional functionality

func NewHTTPClient

func NewHTTPClient(timeout time.Duration, maxRetries int) *HTTPClient

NewHTTPClient creates a new HTTP client with the specified configuration

func (*HTTPClient) DoRequest

func (c *HTTPClient) DoRequest(ctx context.Context, method, url string, body interface{}, opts *RequestOptions) (*http.Response, error)

DoRequest performs an HTTP request with retries and error handling

type RequestOptions

type RequestOptions struct {
	Headers map[string]string
	Query   map[string]string
	Timeout time.Duration
}

RequestOptions contains options for making HTTP requests

Jump to

Keyboard shortcuts

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