(t *testing.T)
| 388 | } |
| 389 | |
| 390 | func TestLoadHTMLFSUsingTLS(t *testing.T) { |
| 391 | ts := setupHTMLFiles( |
| 392 | t, |
| 393 | TestMode, |
| 394 | true, |
| 395 | func(router *Engine) { |
| 396 | router.LoadHTMLFS(tmplFS, "hello.tmpl", "raw.tmpl") |
| 397 | }, |
| 398 | ) |
| 399 | defer ts.Close() |
| 400 | |
| 401 | // Use InsecureSkipVerify for avoiding `x509: certificate signed by unknown authority` error |
| 402 | tr := &http.Transport{ |
| 403 | TLSClientConfig: &tls.Config{ |
| 404 | InsecureSkipVerify: true, |
| 405 | }, |
| 406 | } |
| 407 | client := &http.Client{Transport: tr} |
| 408 | res, err := client.Get(ts.URL + "/test") |
| 409 | if err != nil { |
| 410 | t.Error(err) |
| 411 | } |
| 412 | |
| 413 | resp, _ := io.ReadAll(res.Body) |
| 414 | assert.Equal(t, "<h1>Hello world</h1>", string(resp)) |
| 415 | } |
| 416 | |
| 417 | func TestLoadHTMLFSFuncMap(t *testing.T) { |
| 418 | ts := setupHTMLFiles( |
nothing calls this directly
no test coverage detected