http

package
v0.1.17 Latest Latest
Warning

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

Go to latest
Published: Mar 18, 2020 License: Apache-2.0 Imports: 9 Imported by: 8

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func HandleResponse added in v0.1.15

func HandleResponse(r *gohttp.Response) ([]byte, error)

HandleResponse handles response

Types

type Client

type Client struct {
	*gohttp.Client
	// contains filtered or unexported fields
}

Client client of http server

func NewClient

func NewClient(ops ClientOptions) *Client

NewClient creates a new http client

func (*Client) Call

func (c *Client) Call(service, function string, payload []byte) ([]byte, error)

Call calls the function of service via HTTP POST

type ClientConfig added in v0.1.13

type ClientConfig struct {
	Address               string        `yaml:"address" json:"address"`
	Timeout               time.Duration `yaml:"timeout" json:"timeout" default:"30s"`
	KeepAlive             time.Duration `yaml:"keepalive" json:"keepalive" default:"30s"`
	MaxIdleConns          int           `yaml:"maxIdleConns" json:"maxIdleConns" default:"100"`
	IdleConnTimeout       time.Duration `yaml:"idleConnTimeout" json:"idleConnTimeout" default:"90s"`
	TLSHandshakeTimeout   time.Duration `yaml:"tlsHandshakeTimeout" json:"tlsHandshakeTimeout" default:"10s"`
	ExpectContinueTimeout time.Duration `yaml:"expectContinueTimeout" json:"expectContinueTimeout" default:"1s"`
	utils.Certificate     `yaml:",inline" json:",inline"`
}

ClientConfig client config

func (ClientConfig) ToClientOptions added in v0.1.13

func (cc ClientConfig) ToClientOptions() (*ClientOptions, error)

ToClientOptions converts client config to client options

type ClientOptions

type ClientOptions struct {
	Address               string
	TLSConfig             *tls.Config
	Timeout               time.Duration
	KeepAlive             time.Duration
	MaxIdleConns          int
	IdleConnTimeout       time.Duration
	TLSHandshakeTimeout   time.Duration
	ExpectContinueTimeout time.Duration
}

ClientOptions client options

func NewClientOptions

func NewClientOptions() ClientOptions

NewClientOptions creates client options with default values

Jump to

Keyboard shortcuts

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