http

package
v0.0.13 Latest Latest
Warning

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

Go to latest
Published: Sep 26, 2021 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const ErrorCode = -1

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

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

func NewHttpClient

func NewHttpClient(transport *http.Transport, logger logging.Logger) *Client

func (*Client) Delete

func (h *Client) Delete(url string, params []KeyValue, body interface{}, header []KeyValue) (error, int, []byte)

func (*Client) Get

func (h *Client) Get(url string, params []KeyValue, body interface{}, header []KeyValue) (error, int, []byte)

func (*Client) Post

func (h *Client) Post(url string, params []KeyValue, body interface{}, header []KeyValue) (error, int, []byte)

func (*Client) Put

func (h *Client) Put(url string, params []KeyValue, body interface{}, header []KeyValue) (error, int, []byte)

func (*Client) Request

func (h *Client) Request(method, u string, params []KeyValue, requestBody interface{}, headers []KeyValue) (err error, code int, respBody []byte)

type IHttpClient

type IHttpClient interface {
	Request(method, url string, params []KeyValue, body interface{}, header []KeyValue) (error, int, []byte)
	Get(url string, params []KeyValue, body interface{}, header []KeyValue) (error, int, []byte)
	Post(url string, params []KeyValue, body interface{}, header []KeyValue) (error, int, []byte)
	Delete(url string, params []KeyValue, body interface{}, header []KeyValue) (error, int, []byte)
	Put(url string, params []KeyValue, body interface{}, header []KeyValue) (error, int, []byte)
}

type KeyValue

type KeyValue struct {
	Key   string `json:"key"`
	Value string `json:"value"`
}

Jump to

Keyboard shortcuts

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