httpclient

package
v2.2.0 Latest Latest
Warning

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

Go to latest
Published: Sep 17, 2026 License: Apache-2.0 Imports: 13 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

View Source
const DefaultTimeout = time.Second * 30

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

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

Client struct

func GetClient

func GetClient(insecure bool, timeout time.Duration) *Client

GetClient returns http client

func New

func New(insecure bool, timeout string) *Client

return new client

func (*Client) Execute

func (c *Client) Execute(url, method string, headers map[string]string,
	queryParams map[string]interface{}, body string, responseCode int) (*ResponseConfig, error)

Request implementation

func (*Client) ExecuteJson

func (c *Client) ExecuteJson(url, method string, headers map[string]string, queryParams map[string]interface{},
	body interface{}, responseCode int) (*ResponseConfig, error)

ExecuteJson execute http request and returns response

func (*Client) ExecuteMultipart added in v2.2.0

func (c *Client) ExecuteMultipart(url, method string, headers map[string]string, fieldName, filename string, responseCode int) (*ResponseConfig, error)

ExecuteMultipart posts a file as multipart form field "file".

func (*Client) UpdateTimeout

func (c *Client) UpdateTimeout(duration string)

updates timeout

type ResponseConfig

type ResponseConfig struct {
	Method     string            `json:"method"`
	URL        string            `json:"url"`
	StatusCode int               `json:"statusCode"`
	Headers    map[string]string `json:"headers"`
	Body       []byte            `json:"-"`
}

ResponseConfig of a request

func (*ResponseConfig) StringBody

func (rc *ResponseConfig) StringBody() string

returns body as string

Jump to

Keyboard shortcuts

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