ahttp

package
v1.6.5 Latest Latest
Warning

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

Go to latest
Published: May 17, 2024 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func SetUrlBuild added in v1.2.8

func SetUrlBuild(urls string, data map[string]string) string

SetUrlBuild <根据Map对象设置url地址拼接参数>

Types

type HttpSend

type HttpSend struct {
	Client      *http.Client           //Client
	Response    *http.Response         //Response
	Url         string                 //Request address<请求地址>
	ContentType string                 //Request type<网络文件的类型>
	Header      map[string]string      //Request header<请求头>
	Cookies     map[string]string      //Request Cookies<请求Cookies>
	Timeout     time.Duration          //Request timeout<请求超时时间>
	Body        map[string]interface{} //Request body<请求体>
	Method      string                 //Request method<请求类型>
	Files       []string               //Request Files <多个文件>
	File        string                 //Request File <单个文件>
	FileKey     string                 //Request FileKey<文件Key>
	FileName    string                 //Request FileName<文件名称>
	BodyReader  io.Reader              //Request BodyReader<读取器>
	Err         error
	StatusCode  int
	// contains filtered or unexported fields
}

HttpSend Request parameter

func Client

func Client() *HttpSend

Client Default request

func (*HttpSend) Connect

func (h *HttpSend) Connect(url string) (result []byte, err error)

Connect request<CONNECT 请求>

func (*HttpSend) Debug added in v1.2.8

func (h *HttpSend) Debug(debug ...bool) *HttpSend

Debug<用于最后打印>

func (*HttpSend) Delete

func (h *HttpSend) Delete(url string) (result []byte, err error)

Delete request<DELETE 请求>

func (*HttpSend) Get

func (h *HttpSend) Get(url string) (result []byte, err error)

Get request<GET 请求>

func (*HttpSend) Head

func (h *HttpSend) Head(url string) (result []byte, err error)

Head request<HEAD 请求>

func (*HttpSend) Options

func (h *HttpSend) Options(url string) (result []byte, err error)

Options request<OPTIONS 请求嗅探>

func (*HttpSend) Patch

func (h *HttpSend) Patch(url string) (result []byte, err error)

Patch request<PATCH 请求>

func (*HttpSend) Post

func (h *HttpSend) Post(url string) (result []byte, err error)

Post request<POST 请求>

func (*HttpSend) PostForm added in v1.2.8

func (h *HttpSend) PostForm(url string) (result []byte, err error)

PostForm request<Post 表单提交>

func (*HttpSend) PostFormFile added in v1.2.8

func (h *HttpSend) PostFormFile(url, files string) (body []byte, err error)

PostFormFile Request file byte stream<请求文件字节流>

func (*HttpSend) Put

func (h *HttpSend) Put(url string) (result []byte, err error)

Put request<PUT 请求>

func (*HttpSend) Send

func (h *HttpSend) Send() (body []byte, err error)

Send <扩展一般用于手动请求>

func (*HttpSend) SendForm added in v1.2.8

func (h *HttpSend) SendForm() (body []byte, err error)

SendForm <一般用于发送表单请求>

func (*HttpSend) SetBody

func (h *HttpSend) SetBody(body map[string]interface{}) *HttpSend

SetBody Set body<设置请求体>

func (*HttpSend) SetBodyReader added in v1.3.0

func (h *HttpSend) SetBodyReader(BodyReader io.Reader) *HttpSend

SetBodyReader Set body<设置读取器>

func (*HttpSend) SetClient added in v1.5.2

func (h *HttpSend) SetClient(client *http.Client) *HttpSend

SetClient <设置http.Client>

func (*HttpSend) SetContentType added in v1.2.8

func (h *HttpSend) SetContentType(ContentType string) *HttpSend

SetContentType Set Type<设置资源的MIME类型>

func (*HttpSend) SetCookie

func (h *HttpSend) SetCookie(cookies map[string]string) *HttpSend

SetCookie set cookie<设置cookie>

func (*HttpSend) SetFile added in v1.2.8

func (h *HttpSend) SetFile(file string, key ...string) *HttpSend

SetFile Set File<设置单个文件上传路径>

func (*HttpSend) SetFileKey added in v1.2.8

func (h *HttpSend) SetFileKey(fileKey string) *HttpSend

SetFileKey Set File<设置文件的Key>

func (*HttpSend) SetFileKeyAndName added in v1.2.8

func (h *HttpSend) SetFileKeyAndName(fileKey, fileName string) *HttpSend

SetFileKeyAndName Set File<设置文件Key和名称>

func (*HttpSend) SetFileName added in v1.2.8

func (h *HttpSend) SetFileName(fileName string) *HttpSend

SetFileName Set File<设置文件的名称>

func (*HttpSend) SetFiles added in v1.2.8

func (h *HttpSend) SetFiles(files []string) *HttpSend

SetFiles Set Files<设置多个文件路径上传>

func (*HttpSend) SetHeader

func (h *HttpSend) SetHeader(header map[string]string) *HttpSend

SetHeader set header<设置请求头>

func (*HttpSend) SetMethod

func (h *HttpSend) SetMethod(method string) *HttpSend

SetMethod set method<设置请求类型>

func (*HttpSend) SetTimeout

func (h *HttpSend) SetTimeout(timeout time.Duration) *HttpSend

SetTimeout Set Timeout<设置超时>

func (*HttpSend) SetTransport added in v1.5.2

func (h *HttpSend) SetTransport(transport *http.Transport) *HttpSend

SetTransport <设置http.Transport>

func (*HttpSend) SetUrl

func (h *HttpSend) SetUrl(url string) *HttpSend

SetUrl Set url<设置请求地址>

func (*HttpSend) Trace

func (h *HttpSend) Trace(url string) (result []byte, err error)

Trace request<TRACE 请求>

Jump to

Keyboard shortcuts

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