httpclient

package
v2.0.0 Latest Latest
Warning

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

Go to latest
Published: Jun 18, 2023 License: Apache-2.0 Imports: 10 Imported by: 0

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) 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