http

package
v0.0.3 Latest Latest
Warning

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

Go to latest
Published: Feb 16, 2022 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DefaultStringMap = make(map[string]string)
View Source
var Limit *sync.Limit

var httpsync = make(chan bool, 20)

Functions

func SetTimeout

func SetTimeout(millisecond int64)

Types

type Params

type Params struct {
	Param     map[string]string
	Header    map[string]string
	Bodyparma map[string]string
	BodyJson  map[string]string
}

map组合 {别名:参数名}

func (Params) ToString added in v0.0.3

func (p Params) ToString() string

type Req

type Req struct {
	Method string `json:"Method"`

	ParamsMap map[string]string `json:"ParamsMap"`
	HeaderMap map[string]string `json:"ReqHeaderMap"`
	Body      string            `json:"Body"`
	Error     error             `json:"Error"`
	Code      int               `json:"Code"`
	URL       string            `json:"URL"`
	// contains filtered or unexported fields
}

func Get

func Get(url string, headers map[string]string) Req

func Post

func Post(url, body string, headers map[string]string) Req

func (*Req) BeforeReq

func (h *Req) BeforeReq(fu func(*Req)) *Req

func (*Req) Handleinfo

func (h *Req) Handleinfo()

func (*Req) Parmas

func (h *Req) Parmas() string

func (*Req) Request

func (h *Req) Request() Res

func (*Req) SetQPS added in v0.0.3

func (h *Req) SetQPS(num int)

type Res

type Res struct {
	Error         error
	Starttime     int64
	Endtime       int64
	Code          int
	StatusCode    int
	Status        string
	Headers       map[string]string
	Result        string
	RequestHeader map[string]string
}

func PostMultipart

func PostMultipart(url string, body, file, headers map[string]string) Res

func (Res) CostTime

func (hres Res) CostTime() int64

func (*Res) ResToJSON

func (h *Res) ResToJSON(showStruct bool, showJson bool) *Res

printJson 打印响应结果json格式

func (*Res) Result2Struct

func (h *Res) Result2Struct(st interface{}, showstruct bool) error

Jump to

Keyboard shortcuts

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