Documentation ¶
Index ¶
- Constants
- func BuildData(params interface{}, method string) string
- func Get(apiURL string, params url.Values) (resData string, e error)
- func GetRandomChars(num int) string
- func GetRandomSring(num int, str ...string) string
- func OnGetJSON(url, params string) string
- func OnPostForm(url string, data url.Values) (body []byte)
- func OnPostJSON(url, jsonstr string) []byte
- func Post(apiURL string, params url.Values) (resData string, err error)
- func SendGet(url, params string, obj interface{}) bool
- func SendGetEx(url string, reponse interface{}) bool
- func SendGetWithTimeOut(apiUrl string, params url.Values, time_out int) (resData string, e error)
- func SendJsonReq(uri string, data string, headers map[string]string) string
- func SendPost(requestBody interface{}, responseBody interface{}, url string) bool
- func SendPostWithTimeOut(apiUrl string, params url.Values, time_out int) (resData string, e error)
- func SendRpc(url string, msg []byte, headers map[string]string) (string, error)
- func ToJsonString(data map[string]interface{}) string
- func WriteJSON(w http.ResponseWriter, msg interface{})
Constants ¶
View Source
const (
CONN_TIME_OUT = time.Second * 2
)
View Source
const (
VERSION_INFO = "2.0"
)
By Bill Json-Rpc2.0 @filecoin Rpc
Variables ¶
This section is empty.
Functions ¶
func GetRandomChars ¶
func GetRandomSring ¶
func OnPostForm ¶
OnPostForm form 方式发送post请求
func SendGetWithTimeOut ¶
* Get with TimeOut Code == 200 则返回,其他请打印错误 第三个参数设置超时 单位:秒 【0:则默认两秒】
func SendJsonReq ¶
*
@params url 请求地址 @params msg 消息(json字符串)比如 `{"name":"Bill"}` Ps:也可以使用 BuildData 方法构建数据 @params params 泛型list参数 []interface{}{"123",123} @params method 调用方法 call @params header 携带的Http头 map[string]string{}{ "Content-Type" : "application/json", } @return 返回字符串
func SendPostWithTimeOut ¶
* Post with TimeOut Code == 200 则返回,其他请打印错误 第三个参数设置超时 单位:秒 【0:则默认两秒】
func ToJsonString ¶
func WriteJSON ¶
func WriteJSON(w http.ResponseWriter, msg interface{})
WriteJSON 像指定client 发送json 包 msg message.MessageBody
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.