(t *testing.T, c clientPoster, addr string, n int)
| 3198 | } |
| 3199 | |
| 3200 | func testClientPost(t *testing.T, c clientPoster, addr string, n int) { |
| 3201 | var buf []byte |
| 3202 | var args Args |
| 3203 | for i := range n { |
| 3204 | uri := fmt.Sprintf("%s/foo/%d?bar=baz", addr, i) |
| 3205 | args.Set("xx", fmt.Sprintf("yy%d", i)) |
| 3206 | args.Set("zzz", fmt.Sprintf("qwe_%d", i)) |
| 3207 | argsS := args.String() |
| 3208 | statusCode, body, err := c.Post(buf, uri, &args) |
| 3209 | buf = body |
| 3210 | if err != nil { |
| 3211 | t.Errorf("unexpected error when doing http request: %v", err) |
| 3212 | } |
| 3213 | if statusCode != StatusOK { |
| 3214 | t.Errorf("unexpected status code: %d. Expecting %d", statusCode, StatusOK) |
| 3215 | } |
| 3216 | s := string(body) |
| 3217 | if s != argsS { |
| 3218 | t.Errorf("unexpected response %q. Expecting %q", s, argsS) |
| 3219 | } |
| 3220 | } |
| 3221 | } |
| 3222 | |
| 3223 | func testHostClientGet(t *testing.T, c *HostClient, n int) { |
| 3224 | testClientGet(t, c, "http://google.com", n) |
no test coverage detected
searching dependent graphs…