httpclient

package
v1.3.2 Latest Latest
Warning

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

Go to latest
Published: Nov 29, 2022 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Get

func Get(urlStr string, query url.Values, headerOpt ...http.Header) (resStatus int, resHeader http.Header, resBody []byte, err error)

Get 发起 http get 请求

func PostForm

func PostForm(urlStr string, queryBody url.Values, headerOpt ...http.Header) (resStatus int, resHeader http.Header, resBody []byte, err error)

PostForm 发起 http post 表单请求

func PostJSON

func PostJSON(urlStr string, jsonBody []byte, headerOpt ...http.Header) (resStatus int, resHeader http.Header, resBody []byte, err error)

PostJSON 发起 http post json 请求

func Request

func Request(opt *Option) (resStatus int, resHeader http.Header, resBody []byte, err error)

Request 发起 http 请求

Types

type Option

type Option struct {
	URL         string
	Method      string // 默认 POST
	ContentType string // 默认 application/json
	Header      http.Header
	Query       url.Values
	Body        []byte
	Timeout     time.Duration // 请求超时
}

Option http请求客户端参数

Jump to

Keyboard shortcuts

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