MCPcopy Create free account
hub / github.com/dgraph-io/dgraph / TestZeroWithNoTLS

Function TestZeroWithNoTLS

tlstest/zero_https/no_tls/no_tls_test.go:41–60  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

39}
40
41func TestZeroWithNoTLS(t *testing.T) {
42 client := http.Client{
43 Timeout: time.Second * 10,
44 }
45 defer client.CloseIdleConnections()
46 for _, test := range testCasesHttp {
47 request, err := http.NewRequest("GET", "http://"+testutil.GetSockAddrZeroHttp()+test.url, nil)
48 require.NoError(t, err)
49 do, err := client.Do(request)
50 require.NoError(t, err)
51 if do != nil && do.StatusCode != test.statusCode {
52 t.Fatalf("status code is not same. Got: %d Expected: %d", do.StatusCode, test.statusCode)
53 }
54
55 body := readResponseBody(t, do)
56 if !strings.Contains(strings.ReplaceAll(string(body), " ", ""), test.response) {
57 t.Fatalf("response is not same. Got: %s Expected: %s", string(body), test.response)
58 }
59 }
60}
61
62func readResponseBody(t *testing.T, do *http.Response) []byte {
63 defer func() { _ = do.Body.Close() }()

Callers

nothing calls this directly

Calls 3

GetSockAddrZeroHttpFunction · 0.92
FatalfMethod · 0.80
readResponseBodyFunction · 0.70

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…