(t *testing.T)
| 279 | } |
| 280 | |
| 281 | func TestLoadHTMLFilesUsingTLS(t *testing.T) { |
| 282 | ts := setupHTMLFiles( |
| 283 | t, |
| 284 | TestMode, |
| 285 | true, |
| 286 | func(router *Engine) { |
| 287 | router.LoadHTMLFiles("./testdata/template/hello.tmpl", "./testdata/template/raw.tmpl") |
| 288 | }, |
| 289 | ) |
| 290 | defer ts.Close() |
| 291 | |
| 292 | // Use InsecureSkipVerify for avoiding `x509: certificate signed by unknown authority` error |
| 293 | tr := &http.Transport{ |
| 294 | TLSClientConfig: &tls.Config{ |
| 295 | InsecureSkipVerify: true, |
| 296 | }, |
| 297 | } |
| 298 | client := &http.Client{Transport: tr} |
| 299 | res, err := client.Get(ts.URL + "/test") |
| 300 | if err != nil { |
| 301 | t.Error(err) |
| 302 | } |
| 303 | |
| 304 | resp, _ := io.ReadAll(res.Body) |
| 305 | assert.Equal(t, "<h1>Hello world</h1>", string(resp)) |
| 306 | } |
| 307 | |
| 308 | func TestLoadHTMLFilesFuncMap(t *testing.T) { |
| 309 | ts := setupHTMLFiles( |
nothing calls this directly
no test coverage detected