NewInsecure same as New but receives a single host instead of the whole framework. Useful for testing running TLS servers.
(t IrisTesty, setters ...OptionSetter)
| 151 | // NewInsecure same as New but receives a single host instead of the whole framework. |
| 152 | // Useful for testing running TLS servers. |
| 153 | func NewInsecure(t IrisTesty, setters ...OptionSetter) *httpexpect.Expect { |
| 154 | conf := DefaultConfiguration() |
| 155 | for _, setter := range setters { |
| 156 | setter.Set(conf) |
| 157 | } |
| 158 | transport := &http.Transport{ |
| 159 | TLSClientConfig: &tls.Config{InsecureSkipVerify: true, MinVersion: tls.VersionTLS13}, // lint:ignore |
| 160 | } |
| 161 | |
| 162 | testConfiguration := httpexpect.Config{ |
| 163 | BaseURL: conf.URL, |
| 164 | Client: &http.Client{ |
| 165 | Transport: transport, |
| 166 | Jar: httpexpect.NewCookieJar(), |
| 167 | }, |
| 168 | Reporter: httpexpect.NewAssertReporter(t), |
| 169 | } |
| 170 | |
| 171 | if conf.Debug { |
| 172 | testConfiguration.Printers = []httpexpect.Printer{ |
| 173 | httpexpect.NewDebugPrinter(t, true), |
| 174 | } |
| 175 | } |
| 176 | |
| 177 | return httpexpect.WithConfig(testConfiguration) |
| 178 | } |
| 179 | |
| 180 | // Aliases for "net/http/httptest" package. See `Do` package-level function. |
| 181 | var ( |