1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44
| Url := "在此填入你的url"
sendData := map[string]interface{}{ "type": 1, "list": []map[string]interface{}{ { "id": 10001, "name": "testing", }, }, "taskId": 10001, "subjectId": 10001, "status": true, }
marshal, err := json.Marshal(sendData)
buffer := bytes.NewBuffer(marshal)
req, err := http.NewRequest("POST", Url, buffer)
req.Header.Set("Content-Type", "application/json")
client := &http.Client{}
resp, err = client.Do(req) if err != nil { fmt.Println("转发请求出错error............") return }
defer resp.Body.Close() body, err := ioutil.ReadAll(resp.Body) var resMap map[string]interface{} err = json.Unmarshal(body, &resMap)
|