implement remote call for remote action
This commit is contained in:
parent
bc8c508e04
commit
5986d73367
@ -24,7 +24,7 @@ func NewHTTPCaller(url string, origin string, originSubPath string, destSubPath
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (caller *HTTPCaller) CallGet(url string, subpath string) ([]byte, error) {
|
func (caller *HTTPCaller) CallGet(url string, subpath string) ([]byte, error) {
|
||||||
resp, err := http.Get(url + "/" + subpath)
|
resp, err := http.Get(url + subpath)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
@ -35,7 +35,7 @@ func (caller *HTTPCaller) CallGet(url string, subpath string) ([]byte, error) {
|
|||||||
func (caller *HTTPCaller) CallPost(url string, subpath string, body map[string]interface{}) ([]byte, error) {
|
func (caller *HTTPCaller) CallPost(url string, subpath string, body map[string]interface{}) ([]byte, error) {
|
||||||
postBody, _ := json.Marshal(body)
|
postBody, _ := json.Marshal(body)
|
||||||
responseBody := bytes.NewBuffer(postBody)
|
responseBody := bytes.NewBuffer(postBody)
|
||||||
resp, err := http.Post(url+"/"+subpath, "application/json", responseBody)
|
resp, err := http.Post(url+subpath, "application/json", responseBody)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user