(t *testing.T, testName string, req http.Request)
| 823 | } |
| 824 | |
| 825 | func getBody(t *testing.T, testName string, req http.Request) (*http.Response, []byte) { |
| 826 | r, err := http.DefaultClient.Do(&req) |
| 827 | if err != nil { |
| 828 | t.Fatalf("%s: for URL %q, send error: %v", testName, req.URL.String(), err) |
| 829 | } |
| 830 | b, err := ioutil.ReadAll(r.Body) |
| 831 | if err != nil { |
| 832 | t.Fatalf("%s: for URL %q, reading body: %v", testName, req.URL.String(), err) |
| 833 | } |
| 834 | return r, b |
| 835 | } |
| 836 | |
| 837 | type panicOnSeek struct{ io.ReadSeeker } |