req

package
v0.0.0-...-be22c8c Latest Latest
Warning

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

Go to latest
Published: Aug 26, 2019 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type HTTPReqRunner

type HTTPReqRunner struct {
	// 最大请求时间
	Timeout           time.Duration
	StatusCodeChecker func(code int) bool
	// 是否获取响应体
	RetrieveBody bool
	BodyChecker  func(data []byte) bool

	RecordServerIp bool
}

func (*HTTPReqRunner) Run

func (hr *HTTPReqRunner) Run(id string, request interface{}) (report *ReportV1)

type ReportV1

type ReportV1 struct {
	Id         string
	Latency    time.Duration
	IsCorrect  bool
	StatusCode int
	Err        error
	Msg        interface{}
}

func (*ReportV1) CSV

func (r *ReportV1) CSV() string

type Runner

type Runner interface {
	// 执行请求, 并报告, 不同的请求式, 通过不同的结构体实现.
	Run(id string, r interface{}) *ReportV1
}

执行 http 请求. 依据不同的要求, 实现 Report 方法, 输出不同的内容. (如对端 ip)

Jump to

Keyboard shortcuts

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