http

package
v0.0.0-...-2e9e358 Latest Latest
Warning

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

Go to latest
Published: Feb 18, 2023 License: GPL-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func HeaderAddBasicAuth

func HeaderAddBasicAuth(header map[string]string, username string, password string) map[string]string

Types

type HttpClient

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

func NewHttpClient

func NewHttpClient(proxy string) (ret *HttpClient, e error)

func (*HttpClient) DoDelete

func (h *HttpClient) DoDelete(httpUrl string, params map[string]string, header map[string]string) (ret []byte, e error)

func (*HttpClient) DoDeleteRetJson

func (h *HttpClient) DoDeleteRetJson(httpUrl string, params map[string]string, rsp interface{}, header map[string]string) (e error)

func (*HttpClient) DoGet

func (h *HttpClient) DoGet(httpUrl string, params map[string]string, header map[string]string) (ret []byte, e error)

func (*HttpClient) DoGetRetJson

func (h *HttpClient) DoGetRetJson(httpUrl string, params map[string]string, rsp interface{}, header map[string]string) (e error)

func (*HttpClient) DoPatch

func (h *HttpClient) DoPatch(httpUrl string, params map[string]string, header map[string]string) (ret []byte, e error)

func (*HttpClient) DoPatchRetJson

func (h *HttpClient) DoPatchRetJson(httpUrl string, params map[string]string, rsp interface{}, header map[string]string) (e error)

func (*HttpClient) DoPost

func (h *HttpClient) DoPost(httpUrl string, params map[string]string, header map[string]string) (ret []byte, e error)

func (*HttpClient) DoPostRetJson

func (h *HttpClient) DoPostRetJson(httpUrl string, params map[string]string, rsp interface{}, header map[string]string) (e error)

func (*HttpClient) DoPut

func (h *HttpClient) DoPut(httpUrl string, params map[string]string, header map[string]string) (ret []byte, e error)

func (*HttpClient) DoPutEmptyRetJson

func (h *HttpClient) DoPutEmptyRetJson(httpUrl string, rsp interface{}, header map[string]string) (e error)

func (*HttpClient) DoPutRetJson

func (h *HttpClient) DoPutRetJson(httpUrl string, params map[string]string, rsp interface{}, header map[string]string) (e error)

func (*HttpClient) DoRequest

func (h *HttpClient) DoRequest(httpUrl string, params interface{}, httpMethod Method, header map[string]string) (ret []byte, e error)

func (*HttpClient) DoRequest2

func (h *HttpClient) DoRequest2(httpUrl string, params interface{}, httpMethod Method, header map[string]string) (ret []byte, statsCode int, e error)

func (*HttpClient) DoRequest2WithRetHeader

func (h *HttpClient) DoRequest2WithRetHeader(httpUrl string, params interface{}, httpMethod Method, header map[string]string) (ret []byte, statsCode int, rspHeader http.Header, e error)

func (*HttpClient) DoRequest2WithRetRsp

func (h *HttpClient) DoRequest2WithRetRsp(httpUrl string, params interface{}, httpMethod Method, header map[string]string) (res *http.Response, e error)

func (*HttpClient) DoRequestJsonWithRetHeader2

func (h *HttpClient) DoRequestJsonWithRetHeader2(httpUrl string, jsonData interface{}, header map[string]string, method Method) (ret []byte, statsCode int, rspHeader http.Header, e error)

func (*HttpClient) DoRequestPostJson

func (h *HttpClient) DoRequestPostJson(httpUrl string, jsonData interface{}, header map[string]string) (ret []byte, statsCode int, e error)

func (*HttpClient) DoRequestPostJsonWithRetHeader

func (h *HttpClient) DoRequestPostJsonWithRetHeader(httpUrl string, jsonData interface{}, header map[string]string) (ret []byte, statsCode int, rspHeader http.Header, e error)

func (*HttpClient) DoRequestRetJson

func (h *HttpClient) DoRequestRetJson(httpUrl string, params map[string]string, httpMethod Method, ret interface{}, header map[string]string) (e error)

func (*HttpClient) FetchResult

func (c *HttpClient) FetchResult(httpUrl string, params interface{}, method Method, header map[string]string) (ret []byte, statusCode int, rspHeader http.Header, e error)

func (*HttpClient) GetHttpClient

func (h *HttpClient) GetHttpClient() *http.Client

func (*HttpClient) Init

func (h *HttpClient) Init(proxy string) (e error)

func (*HttpClient) SendJson

func (h *HttpClient) SendJson(method Method, url string, data interface{}, headers map[string]string) (*http.Response, error)

func (*HttpClient) SendRequest

func (c *HttpClient) SendRequest(httpUrl string, params interface{}, method Method, header map[string]string) (res *http.Response, e error)

type Method

type Method int

Method ...

const (
	// MethodUnknown ...
	MethodUnknown Method = iota
	Get
	Post
	Put
	Patch
	Delete
	PutEmpty
	GetJSON
	PostJSON
	PutJSON
	PatchJSON
	DeleteJSON
)

func (*Method) ToString

func (c *Method) ToString() string

Jump to

Keyboard shortcuts

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