handler

package
v0.0.0-...-4f87869 Latest Latest
Warning

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

Go to latest
Published: Feb 24, 2020 License: Apache-2.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ApiRequest

type ApiRequest struct {
	Input    map[string]interface{}
	Template string
	Output   string
	Method   string
	Path     string
	Schema   string
	Host     string
	URL      string
	Params   map[string]string
	Headers  map[string]interface{}
	Body     interface{}
}

func NewApiRequest

func NewApiRequest(template string, input map[string]interface{}) (*ApiRequest, error)

func (*ApiRequest) Render

func (r *ApiRequest) Render() (*ApiRequest, error)

func (*ApiRequest) Wrapper

func (r *ApiRequest) Wrapper() (*http.Request, error)

type ApiRequestInput

type ApiRequestInput map[string]interface{}

type AuthRequestHandler

type AuthRequestHandler struct {
	Client *http.Client
	Auth   *common.Auth
}

func (*AuthRequestHandler) RequestHandlerFunc

func (h *AuthRequestHandler) RequestHandlerFunc(req *http.Request) error

type Facade

type Facade struct {
	Client *http.Client
	// url => handlers
	PatternHandlerMap map[string]Handler
}

func (*Facade) Do

func (r *Facade) Do(req *http.Request) (*http.Response, error)

通用执行函数

type Handler

type Handler struct {
	RequestFns  map[string]RequestHandlerFunc
	ResponseFns map[string]ResponseHandlerFunc
}

type RequestHandlerFunc

type RequestHandlerFunc func(req *http.Request) error

type ResponseHandlerFunc

type ResponseHandlerFunc func(resp *http.Response) error

Jump to

Keyboard shortcuts

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