http

package
v1.9.1 Latest Latest
Warning

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

Go to latest
Published: Feb 21, 2023 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client interface {
	Get(url string, query interface{}, header map[string]string) (Response, error)
	Post(url string, body interface{}, header map[string]string) (Response, error)
	Put(url string, body interface{}, header map[string]string) (Response, error)
	Patch(url string, body interface{}, header map[string]string) (Response, error)
	Delete(url string, body interface{}, header map[string]string) (Response, error)
	Request(method string, url string, body interface{}, header map[string]string) (Response, error)
}

Client is an Adapter for resty client

type HTTP added in v1.4.0

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

HTTP client

func NewHTTP added in v1.4.0

func NewHTTP() *HTTP

NewHTTP returns a new instance of HTTP

func (*HTTP) Delete added in v1.4.0

func (h *HTTP) Delete(url string, body interface{}, header map[string]string) (Response, error)

Delete sends a DELETE request

func (*HTTP) Get added in v1.4.0

func (h *HTTP) Get(url string, query interface{}, header map[string]string) (Response, error)

Get sends a GET request

func (*HTTP) Patch added in v1.4.0

func (h *HTTP) Patch(url string, body interface{}, header map[string]string) (Response, error)

Patch sends a PATCH request

func (*HTTP) Post added in v1.4.0

func (h *HTTP) Post(url string, body interface{}, header map[string]string) (Response, error)

Post sends a POST request

func (*HTTP) Put added in v1.4.0

func (h *HTTP) Put(url string, body interface{}, header map[string]string) (Response, error)

Put sends a PUT request

func (*HTTP) Request added in v1.4.0

func (h *HTTP) Request(method, url string, body interface{}, header map[string]string) (Response, error)

Request sends a http request

type Response added in v1.4.1

type Response interface {
	Status() string
	StatusCode() int
	Body() []byte
	Header() nethttp.Header
	Cookies() []*nethttp.Cookie
}

Response is an Adapter for resty response

Jump to

Keyboard shortcuts

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