| | |
| | | Body []byte `json:"body"` |
| | | } |
| | | |
| | | type reply struct { |
| | | Success bool `json:"success"` |
| | | Msg string `json:"msg"` |
| | | Data interface{} `json:"data"` |
| | | } |
| | | |
| | | func (sc SBusClient) DoGetRequest(url string, params map[string]string, headers map[string]string) ([]byte, error) { |
| | | if sc.nodes == nil || len(sc.nodes) == 0 { |
| | | return nil, errors.New("invalid netNodes") |
| | |
| | | return nil, fmt.Errorf("doReq s.SendandrecvTimeout result n:%d", n) |
| | | } else { |
| | | if len(ret) > 0 { |
| | | var retMsg MsgInfo |
| | | err = json.Unmarshal(ret[0].Data, &retMsg) |
| | | if err != nil { |
| | | logPrint("doReq unmarshal to MsgInfo err:", err) |
| | | return nil, err |
| | | } |
| | | return retMsg.Body, nil |
| | | return ret[0].Data, nil |
| | | } |
| | | return nil, fmt.Errorf("no any response") |
| | | } |