Documentation ¶
Overview ¶
Package client provides methods to do http GET / POST request.
Index ¶
- func HTTPGet(url string, params, headers map[string]string, timeout int) (*http.Response, error)
- func HTTPPost(url string, body interface{}, params, headers map[string]string, timeout int) (*http.Response, error)
- func HTTPRawPost(url, body string, params, headers map[string]string, timeout int) (*http.Response, error)
- func InitHTTPClient()
- func RPCGet(result interface{}, url string) error
- func RPCGetRequest(result interface{}, url string, params, headers map[string]string, timeout int) error
- func RPCGetWithTimeout(result interface{}, url string, timeout int) error
- func RPCPost(result interface{}, url, method string, params ...interface{}) error
- func RPCPostRequest(url string, req *Request, result interface{}) error
- func RPCPostWithTimeout(timeout int, result interface{}, url, method string, params ...interface{}) error
- func RPCPostWithTimeoutAndID(result interface{}, timeout, id int, url, method string, params ...interface{}) error
- func RPCRawGet(url string) (string, error)
- func RPCRawGetRequest(url string, params, headers map[string]string, timeout int) (string, error)
- func RPCRawGetWithTimeout(url string, timeout int) (string, error)
- func RPCRawPost(url, body string) (string, error)
- func RPCRawPostWithTimeout(url, reqBody string, timeout int) (string, error)
- type Request
- type RequestBody
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func HTTPPost ¶
func HTTPPost(url string, body interface{}, params, headers map[string]string, timeout int) (*http.Response, error)
HTTPPost http post
func HTTPRawPost ¶
func HTTPRawPost(url, body string, params, headers map[string]string, timeout int) (*http.Response, error)
HTTPRawPost http raw post
func RPCGetRequest ¶
func RPCGetRequest(result interface{}, url string, params, headers map[string]string, timeout int) error
RPCGetRequest rpc get request
func RPCGetWithTimeout ¶
RPCGetWithTimeout rpc get with timeout
func RPCPostRequest ¶
RPCPostRequest rpc post request
func RPCPostWithTimeout ¶
func RPCPostWithTimeout(timeout int, result interface{}, url, method string, params ...interface{}) error
RPCPostWithTimeout rpc post with timeout
func RPCPostWithTimeoutAndID ¶
func RPCPostWithTimeoutAndID(result interface{}, timeout, id int, url, method string, params ...interface{}) error
RPCPostWithTimeoutAndID rpc post with timeout and id
func RPCRawGetRequest ¶
RPCRawGetRequest rpc raw get request
func RPCRawGetWithTimeout ¶
RPCRawGetWithTimeout rpc raw get with timeout
Types ¶
type Request ¶
Request json rpc request
func NewRequest ¶
NewRequest new request
func NewRequestWithTimeoutAndID ¶
NewRequestWithTimeoutAndID new request with timeout and id
type RequestBody ¶
type RequestBody struct { Version string `json:"jsonrpc"` Method string `json:"method"` Params interface{} `json:"params"` ID int `json:"id"` }
RequestBody request body
Click to show internal directories.
Click to hide internal directories.