client

package
v1.0.8 Latest Latest
Warning

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

Go to latest
Published: Jun 7, 2019 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BuildUrl

func BuildUrl(req *HttpRequest) string

Types

type HttpHeader

type HttpHeader struct {
	Name  string `yaml:"name" json:"name"`
	Value string `yaml:"value" json:"value"`
}

type HttpInvoker

type HttpInvoker interface {
	Do(req *HttpRequest, interceptors ...Interceptor) (res *HttpResponse, err error)
}

type HttpInvokerImpl

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

func NewHttpInvoker

func NewHttpInvoker(opts *HttpInvokerOptions) (c *HttpInvokerImpl, err error)

func (*HttpInvokerImpl) Do

func (c *HttpInvokerImpl) Do(req *HttpRequest, interceptors ...Interceptor) (*HttpResponse, error)

type HttpInvokerOptions

type HttpInvokerOptions struct {
	PDP string
}

type HttpRequest

type HttpRequest struct {
	Method  string       `yaml:"method,omitempty" json:"method"`
	Url     string       `yaml:"url,omitempty" json:"url"`
	PDP     string       `yaml:"pdp,omitempty" json:"pdp"`
	Path    string       `yaml:"path,omitempty" json:"path"`
	Headers []HttpHeader `yaml:"headers,omitempty" json:"headers"`
	Body    string       `yaml:"body,omitempty" json:"body"`
	Timeout *string      `yaml:"timeout,omitempty" json:"timeout"`
	// contains filtered or unexported fields
}

func (*HttpRequest) GetRawRequest

func (r *HttpRequest) GetRawRequest() (req *http.Request, err error)

type HttpResponse

type HttpResponse struct {
	Status        string
	StatusCode    int
	Version       string
	Header        http.Header
	ContentLength int64
	Body          []byte
	// contains filtered or unexported fields
}

func NewHttpResponse

func NewHttpResponse(lowRes *http.Response) (res *HttpResponse, err error)

func (*HttpResponse) GetRawResponse

func (r *HttpResponse) GetRawResponse() (res *http.Response, err error)

type Interceptor

type Interceptor interface{}

type PostProcessor

type PostProcessor interface {
	Interceptor
	PostProcess(req *HttpRequest, res *HttpResponse) error
}

type PreProcessor

type PreProcessor interface {
	Interceptor
	PreProcess(req *HttpRequest) error
}

Jump to

Keyboard shortcuts

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