xhttp

package
v0.5.7 Latest Latest
Warning

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

Go to latest
Published: Apr 30, 2024 License: MIT Imports: 8 Imported by: 1

Documentation

Index

Constants

View Source
const TypeNode = "xhttp"

Variables

View Source
var (
	ContentTypeApplicationJSON = constants.ContentTypeApplicationJSON
	ContentTypeTextPlain       = constants.ContentTypeTextPlain
	ContentTypeUrlencoded      = constants.ContentTypeUrlencoded
)

Functions

func Deregister

func Deregister(name string)

Deregister 清理配置适配器

func NewBuilder

func NewBuilder() container.StandardBuilder

func Register

func Register(resolver httpResover)

Register 注册配置文件适配器

Types

type Body

type Body = httputil.Body

type Client

type Client interface {
	//Swap 将当前请求参数作为RPC参数并发送RPC请求
	Swap(ctx context.Context, service string, opts ...RequestOption) (res Body, err error)

	//RequestByCtx RPC请求,可通过context撤销请求
	Request(ctx sctx.Context, service string, input interface{}, opts ...RequestOption) (res Body, err error)
}

type Options

type Options struct {
	Method  string
	Version string
	Header  xtypes.SMap
}

type RequestOption

type RequestOption func(*Options)

func WithContentType

func WithContentType(contentType string) RequestOption

func WithHeaders

func WithHeaders(header map[string]string) RequestOption

func WithMethod

func WithMethod(method string) RequestOption

func WithXRequestID

func WithXRequestID(requestID string) RequestOption

type StandardHttp

type StandardHttp interface {
	GetHttp(name string) (c Client)
}

func NewXhttp

func NewXhttp(container container.Container) StandardHttp

NewXhttp 服务代理

Jump to

Keyboard shortcuts

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