http

package
v1.0.2 Latest Latest
Warning

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

Go to latest
Published: Apr 28, 2021 License: MIT Imports: 18 Imported by: 0

Documentation

Overview

Package http 提供基础 http 客户端组件 内置以下功能: - logging - opentracing - prometheus

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DoHttpFormReq

func DoHttpFormReq(ctx context.Context, urlStr string, params interface{}, options ...interface{}) (reqResp *http.Response, bodyByte []byte, err error)

func DoHttpFormUploadReq

func DoHttpFormUploadReq(ctx context.Context, urlStr, filedName, filename string) (reqResp *http.Response, bodyByte []byte, err error)

func DoHttpJsonReq

func DoHttpJsonReq(ctx context.Context, urlStr string, params interface{}, options ...interface{}) (reqResp *http.Response, bodyByte []byte, err error)

func DoHttpReq

func DoHttpReq(ctx context.Context, urlStr string, params interface{}, options ...interface{}) (reqResp *http.Response, bodyByte []byte, err error)

Types

type Client

type Client interface {
	// Do 发送单个 http 请求
	Do(ctx context.Context, req *http.Request) (*http.Response, error)
}

Client http 客户端接口

func NewClient

func NewClient(timeout time.Duration) Client

NewClient 创建 Client 实例

Jump to

Keyboard shortcuts

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