http

package
v0.5.23 Latest Latest
Warning

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

Go to latest
Published: Oct 11, 2024 License: MIT Imports: 27 Imported by: 1

Documentation

Index

Constants

View Source
const Proto = "xhttp"

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

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

func NewClient

func NewClient(registrar registry.Registrar, setting *setting, reqPath *url.URL) (*Client, error)

NewClientByConf 创建RPC客户端,地址是远程RPC服务器地址或注册中心地址

func (*Client) Close

func (c *Client) Close()

Close 关闭RPC客户端连接

func (*Client) RequestByString

func (c *Client) RequestByString(ctx context.Context, reqPath *url.URL, input []byte, opts ...xhttp.RequestOption) (res xhttp.Body, err error)

RequestByString 发送Request请求

type Request

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

Request RPC Request

func NewRequest

func NewRequest(setting *setting) *Request

NewRequest 构建请求

func (*Request) Close

func (r *Request) Close() error

Close 关闭RPC连接

func (*Request) Request

func (r *Request) Request(ctx sctx.Context, service string, input interface{}, opts ...xhttp.RequestOption) (res xhttp.Body, err error)

RequestByCtx RPC请求,可通过context撤销请求 service=http://servername/path

func (*Request) Swap

func (r *Request) Swap(ctx context.Context, service string, opts ...xhttp.RequestOption) (res xhttp.Body, err error)

Swap 将当前请求参数作为RPC参数并发送RPC请求

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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