samplehttp

package
v1.0.9 Latest Latest
Warning

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

Go to latest
Published: Jun 4, 2024 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	GetMethod    = "GET"
	PostMethod   = "POST"
	PutMethod    = "PUT"
	PatchMethod  = "PATCH"
	DeleteMethod = "DELETE"
)

Variables

View Source
var NewProvider = func(scheme, instance string) (*SampleProvider, error) {
	return New(scheme, instance)
}

Functions

This section is empty.

Types

type IOptionFun added in v1.0.4

type IOptionFun interface {
	AddHeader(map[string]string) map[string]string
	AddParam(map[string]string) map[string]string
	AddBody(body interface{}) error
	GetHeader() map[string]string
	GetParam() map[string]string
	GetBody() []byte
}

type Option added in v1.0.4

type Option struct {
	Header map[string]string
	Param  map[string]string
	Body   *strings.Reader
}

func (*Option) AddBody added in v1.0.4

func (o *Option) AddBody(body interface{}) error

func (*Option) AddHeader added in v1.0.4

func (o *Option) AddHeader(header map[string]string) map[string]string

func (*Option) AddParam added in v1.0.4

func (o *Option) AddParam(param map[string]string) map[string]string

func (*Option) GetBody added in v1.0.4

func (o *Option) GetBody() []byte

func (*Option) GetHeader added in v1.0.4

func (o *Option) GetHeader() map[string]string

func (*Option) GetParam added in v1.0.4

func (o *Option) GetParam() map[string]string

type SampleProvider

type SampleProvider struct {
	Address    string
	Scheme     string
	HttpClient *guzzle.Client
	Log        logx.Logger
	Context    context.Context
}

func New

func New(scheme, address string) (*SampleProvider, error)

func (*SampleProvider) Byte added in v1.0.7

func (p *SampleProvider) Byte(out *guzzle.Response) ([]byte, error)

func (*SampleProvider) Do added in v1.0.4

func (p *SampleProvider) Do(method, uri string, option IOptionFun) *guzzle.Response

func (*SampleProvider) Json added in v1.0.7

func (p *SampleProvider) Json(out *guzzle.Response, useStruct interface{}) (interface{}, error)

func (*SampleProvider) SetBaseAuth added in v1.0.4

func (p *SampleProvider) SetBaseAuth(username, password string) *SampleProvider

func (*SampleProvider) SetDebug added in v1.0.4

func (p *SampleProvider) SetDebug(v bool) *SampleProvider

func (*SampleProvider) SetTransport added in v1.0.4

func (p *SampleProvider) SetTransport(transportFn func() *http.Transport) *SampleProvider

func (*SampleProvider) SetValidateHost added in v1.0.4

func (p *SampleProvider) SetValidateHost(v bool) *SampleProvider

func (*SampleProvider) Xml added in v1.0.7

func (p *SampleProvider) Xml(out *guzzle.Response, useStruct interface{}) (interface{}, error)

Jump to

Keyboard shortcuts

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