httpsend

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Dec 30, 2020 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	CONN_TIME_OUT = time.Second * 2
)

Variables

This section is empty.

Functions

func Get

func Get(apiURL string, params url.Values) (resData string, e error)

*

Get
@author Bill

func OnGetJSON

func OnGetJSON(url, params string) string

OnGetJSON 发送get 请求

func OnPostForm

func OnPostForm(url string, data url.Values) (body []byte)

OnPostForm form 方式发送post请求

func OnPostJSON

func OnPostJSON(url, jsonstr string) []byte

OnPostJSON 发送修改密码

func Post

func Post(apiURL string, params url.Values) (resData string, err error)

* 网络请求POST

func SendGet

func SendGet(url, params string, obj interface{}) bool

SendGet 发送get 请求 返回对象

func SendGetEx

func SendGetEx(url string, reponse interface{}) bool

SendGetEx 发送GET请求

func SendGetWithTimeOut

func SendGetWithTimeOut(apiUrl string, params url.Values, time_out int) (resData string, e error)

* Get with TimeOut Code == 200 则返回,其他请打印错误 第三个参数设置超时 单位:秒 【0:则默认两秒】

func SendPost

func SendPost(requestBody interface{}, responseBody interface{}, url string) bool

SendPost 发送POST请求

func SendPostWithTimeOut

func SendPostWithTimeOut(apiUrl string, params url.Values, time_out int) (resData string, e error)

* Post with TimeOut Code == 200 则返回,其他请打印错误 第三个参数设置超时 单位:秒 【0:则默认两秒】

func WriteJSON

func WriteJSON(w http.ResponseWriter, msg interface{})

WriteJSON 像指定client 发送json 包 msg message.MessageBody

Types

This section is empty.

Jump to

Keyboard shortcuts

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