request

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Dec 31, 2024 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var GlobalMapmap = make(map[string]string)

Functions

This section is empty.

Types

type Request

type Request struct {
	Name    string            `json:"name"`
	Method  string            `json:"method"`
	Url     *url.URL          `json:"url"`
	Query   map[string]string `json:"query"`
	Body    string            `json:"body"`
	Headers map[string]string `json:"headers"`
	Timeout int               `json:"timeout" default:"5 毫秒"`
	Retry   int               `json:"retry" default:"0"`

	ExpectBody map[string]interface{}
	// contains filtered or unexported fields
}

func NewRequest

func NewRequest(name string, method string, uri string, query map[string]string, body string, headers map[string]string, timeout int, inerror error) *Request

func (*Request) GetError

func (r *Request) GetError() error

func (*Request) Run

func (r *Request) Run() Response

func (*Request) SetExpectBody

func (r *Request) SetExpectBody(expectBody map[string]interface{}) *Request

func (*Request) String

func (r *Request) String() string

type Response

type Response struct {
	StatusCode  int               `json:"status_code"`
	Reason      string            `json:"reason"`
	Headers     map[string]string `json:"headers"`
	ContentType string            `json:"content-type"`
	Result      string            `json:"result"`
	Error       error             `json:"error"`
	StartTime   int64             `json:"startTime"`
	EndTime     int64             `json:"endTime"`
	Cost        int64             `json:"cost"`
	Req         *Request          `json:"request"`
	Url         string            `json:"url"`
	// contains filtered or unexported fields
}

func PostMultipart

func PostMultipart(name, Url string, query, body, file, headers map[string]string, timeout int, error error) Response

func (Response) GetExpectBody

func (r Response) GetExpectBody() map[string]interface{}

func (Response) GetResult

func (r Response) GetResult() interface{}

func (Response) String

func (r Response) String() string

Jump to

Keyboard shortcuts

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