| 45 | } |
| 46 | |
| 47 | func post(addr string, i int64) { |
| 48 | resp, err := http.Post("http://"+addr+"/goim/push/room?operation=1000&type=test&room="+os.Args[1], "application/json", bytes.NewBufferString(fmt.Sprintf("{\"test\":%d}", i))) |
| 49 | if err != nil { |
| 50 | fmt.Printf("Error: http.post() error(%v)\n", err) |
| 51 | return |
| 52 | } |
| 53 | defer resp.Body.Close() |
| 54 | body, err := ioutil.ReadAll(resp.Body) |
| 55 | if err != nil { |
| 56 | fmt.Printf("Error: http.post() error(%v)\n", err) |
| 57 | return |
| 58 | } |
| 59 | |
| 60 | fmt.Printf("%s postId:%d, response:%s\n", time.Now().Format("2006-01-02 15:04:05"), i, string(body)) |
| 61 | } |