MCPcopy
hub / github.com/Terry-Mao/goim / post

Function post

benchmarks/push_room/main.go:47–61  ·  view source on GitHub ↗
(addr string, i int64)

Source from the content-addressed store, hash-verified

45}
46
47func 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}

Callers 1

runFunction · 0.85

Calls 2

PrintfMethod · 0.80
CloseMethod · 0.65

Tested by

no test coverage detected