util

package
v0.0.0-...-e3952f1 Latest Latest
Warning

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

Go to latest
Published: Feb 24, 2023 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Caller

type Caller interface {
	Do(req *http.Request) (*http.Response, error)
}

type HttpClient

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

func New

func New() *HttpClient

New HttpClient with default httpclient

func (*HttpClient) AddHeader

func (this *HttpClient) AddHeader(key, value string) *HttpClient

Add header

func (*HttpClient) BasePath

func (this *HttpClient) BasePath(url string) *HttpClient

Set basepath

func (*HttpClient) Call

func (this *HttpClient) Call(req *http.Request, successF, failureF interface{}) (*http.Response, error)

func (*HttpClient) Caller

func (this *HttpClient) Caller(caller *http.Client) *HttpClient

Set the caller

func (*HttpClient) Client

func (this *HttpClient) Client(hc *http.Client) *HttpClient

Set httpi client for tranportation OAuth impelemntation

func (*HttpClient) Get

func (this *HttpClient) Get(path string) *HttpClient

GET

func (*HttpClient) Head

func (this *HttpClient) Head(path string) *HttpClient

HEAD

func (*HttpClient) New

func (this *HttpClient) New() *HttpClient

Clone and return new httpclient

func (*HttpClient) Path

func (this *HttpClient) Path(path string) *HttpClient

Path

func (*HttpClient) Post

func (this *HttpClient) Post(path string) *HttpClient

POST

func (*HttpClient) Query

func (this *HttpClient) Query(params interface{}) *HttpClient

func (*HttpClient) Receive

func (this *HttpClient) Receive(successF, failureF interface{}) (*http.Response, error)

Return Receive

func (*HttpClient) Request

func (this *HttpClient) Request() (*http.Request, error)

Return a http.Request

func (*HttpClient) SetBody

func (this *HttpClient) SetBody(bodyJson interface{}) *HttpClient

Set body json

func (*HttpClient) SetHeader

func (this *HttpClient) SetHeader(key, value string) *HttpClient

Set Header

Jump to

Keyboard shortcuts

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