request

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Sep 30, 2020 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ClientBuilder

type ClientBuilder interface {
	SetCommonHeaders(headers http.Header) ClientBuilder
	SetConnectionTimeout(timeout time.Duration) ClientBuilder
	SetResponseTimeout(timeout time.Duration) ClientBuilder
	SetMaxIdleConnections(connections int) ClientBuilder
	SetHttpClient(client *http.Client) ClientBuilder
	SetUserAgent(agent string) ClientBuilder
	DisableAllTimeouts(disable bool) ClientBuilder
	Build() HttpClient
}

func NewBuilder

func NewBuilder() ClientBuilder

type HttpClient

type HttpClient interface {
	Get(url string, headers ...http.Header) (*Response, error)
	Post(url string, body interface{}, headers ...http.Header) (*Response, error)
	Put(url string, body interface{}, headers ...http.Header) (*Response, error)
	Patch(url string, body interface{}, headers ...http.Header) (*Response, error)
	Delete(url string, headers ...http.Header) (*Response, error)
	Options(url string, headers ...http.Header) (*Response, error)
}

type Response

type Response struct {
	Status     string
	StatusCode int
	Headers    http.Header
	Body       []byte
}

func (*Response) String

func (r *Response) String() string

func (*Response) UnmarshalJSON

func (r *Response) UnmarshalJSON(target interface{}) error

func (*Response) UnmarshalXML

func (r *Response) UnmarshalXML(target interface{}) error

Jump to

Keyboard shortcuts

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