client

package
v0.0.0-...-bfeb8cb Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	Err401StatusCode     = errors.New("unauthorized - 401")
	Err400StatusCode     = errors.New("bad request - 400")
	ErrWrongStatusCode   = errors.New("wrong status code")
	ErrCantCreateRequest = errors.New("can't create request")
)

Functions

This section is empty.

Types

type HTTPClient

type HTTPClient struct {
	Scheme   string
	Host     string
	BasePath string
	// contains filtered or unexported fields
}

func NewHTTPClient

func NewHTTPClient(host, basePath, scheme string, client http.Client) *HTTPClient

func (*HTTPClient) CreateRequest

func (hc *HTTPClient) CreateRequest(ctx context.Context, httpMethod string, url string, header http.Header, body io.Reader, query url.Values) (*http.Request, error)

CreateRequest return http.Request with given parameters. If you don't need some of the parameters then give nil.

func (*HTTPClient) Do

func (hc *HTTPClient) Do(ctx context.Context, r *http.Request) ([]byte, error)

func (*HTTPClient) GetFullUrl

func (hc *HTTPClient) GetFullUrl() *url.URL

func (*HTTPClient) GetUlrWithMethods

func (hc *HTTPClient) GetUlrWithMethods(method string) *url.URL

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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