httpx

package
v0.0.0-...-f8bc7e3 Latest Latest
Warning

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

Go to latest
Published: Feb 10, 2022 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const (
	HeaderUserAgent   = "User-Agent"
	HeaderContentType = "Content-Type"
)
View Source
const (
	ContentTypeJSON = "application/json"
	ContentTypeForm = "application/x-www-form-urlencoded"
)

Variables

This section is empty.

Functions

func NewJSONRequest

func NewJSONRequest(method, url string, header http.Header, jo interface{}) (*http.Request, error)

Types

type Client

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

func NewClient

func NewClient(cfg ClientConfig) *Client

func (*Client) Do

func (c *Client) Do(ctx context.Context, req *http.Request) (*http.Response, error)

func (*Client) GetJSON

func (c *Client) GetJSON(ctx context.Context, url string, params url.Values, header http.Header, res interface{}) error

func (*Client) JSON

func (c *Client) JSON(ctx context.Context, req *http.Request, res interface{}) error

func (*Client) PostForm

func (c *Client) PostForm(ctx context.Context, url string, params url.Values, header http.Header, res interface{}) error

func (*Client) PostJSON

func (c *Client) PostJSON(ctx context.Context, url string, params url.Values, header http.Header, jo interface{}, res interface{}) error

type ClientConfig

type ClientConfig struct {
	Timeout      time.Duration
	DebugEnabled bool
}

type Server

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

func NewServer

func NewServer(opts ...ServerOption) *Server

func (*Server) Gin

func (s *Server) Gin() *gin.Engine

func (*Server) Run

func (s *Server) Run()

type ServerOption

type ServerOption func(o *Server)

func WithAddress

func WithAddress(addr string) ServerOption

func WithTLS

func WithTLS(certPath, keyPath string) ServerOption

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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