(t *testing.T)
| 39 | } |
| 40 | |
| 41 | func 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 | |
| 62 | func readResponseBody(t *testing.T, do *http.Response) []byte { |
| 63 | defer func() { _ = do.Body.Close() }() |
nothing calls this directly
no test coverage detected
searching dependent graphs…