| 123456789101112131415161718192021222324252627282930313233343536373839404142 | package forwardimport (	"bytes"	"duoduo/conf"	"io/ioutil"	"net/http")func PostForward(inputObj []byte, function string) (string, error) {	//数据转json	buffer := bytes.NewBuffer(inputObj)	confIni, errConf := conf.ConnIni()	if errConf != nil {		return "", errConf	}	path := confIni.MustValue("forward", "url")	request, err := http.NewRequest("POST", path+function, buffer)	if err != nil {		return "", err	}	request.Header.Set("Content-Type", "application/json;charset=UTF-8")	client := http.Client{}	//创建客户端	resp, err := client.Do(request) //发送请求	if err != nil {		return "", err	}	respBytes, err := ioutil.ReadAll(resp.Body)	if err != nil {		return "", err	}	return string(respBytes), nil}
 |