curl

package
v0.0.8 Latest Latest
Warning

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

Go to latest
Published: Jun 3, 2023 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Request

type Request struct {
	Raw      *http.Request
	Method   string
	Url      string
	Headers  map[string]string
	Cookies  map[string]string
	Queries  map[string]string
	PostData map[string]interface{}
	// contains filtered or unexported fields
}

Request构造类

func NewRequest

func NewRequest() *Request

创建一个Request实例

func (*Request) Get

func (this *Request) Get() (*Response, error)

发起get请求

func (*Request) Post

func (this *Request) Post() (*Response, error)

发起post请求

func (*Request) Send

func (this *Request) Send(url string, method string) (*Response, error)

发起请求

func (*Request) SetCookies

func (this *Request) SetCookies(cookies map[string]string) *Request

设置请求cookies

func (*Request) SetHeaders

func (this *Request) SetHeaders(headers map[string]string) *Request

设置请求头

func (*Request) SetMethod

func (this *Request) SetMethod(method string) *Request

设置请求方法

func (*Request) SetPostData

func (this *Request) SetPostData(postData map[string]interface{}) *Request

设置post请求的提交数据

func (*Request) SetQueries

func (this *Request) SetQueries(queries map[string]string) *Request

设置url查询参数

func (*Request) SetUrl

func (this *Request) SetUrl(url string) *Request

设置请求地址

type Response

type Response struct {
	Raw     *http.Response
	Headers map[string]string
	Body    string
}

func NewResponse

func NewResponse() *Response

func (*Response) IsOk

func (this *Response) IsOk() bool

Jump to

Keyboard shortcuts

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