MCPcopy
hub / github.com/davyxu/cellnet / validPage

Function validPage

tests/httppage_test.go:43–66  ·  view source on GitHub ↗
(t *testing.T, url, expectAck string)

Source from the content-addressed store, hash-verified

41}
42
43func validPage(t *testing.T, url, expectAck string) {
44 c := &http.Client{
45 Timeout: time.Second * 5,
46 }
47 resp, err := c.Get(url)
48 if err != nil {
49 t.Log("http req failed", err)
50 t.FailNow()
51 }
52
53 defer resp.Body.Close()
54 bodyData, err := ioutil.ReadAll(resp.Body)
55 if err != nil {
56 t.Log("http response failed", err)
57 t.FailNow()
58 }
59
60 body := string(bodyData)
61
62 if body != expectAck {
63 t.Log("unexpect result", err, body)
64 t.FailNow()
65 }
66}

Callers 1

TestPrintPageFunction · 0.85

Calls 1

CloseMethod · 0.65

Tested by

no test coverage detected