MCPcopy
hub / github.com/gin-gonic/gin / TestLoadHTMLFSUsingTLS

Function TestLoadHTMLFSUsingTLS

gin_test.go:390–415  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

388}
389
390func 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
417func TestLoadHTMLFSFuncMap(t *testing.T) {
418 ts := setupHTMLFiles(

Callers

nothing calls this directly

Calls 5

setupHTMLFilesFunction · 0.85
LoadHTMLFSMethod · 0.80
CloseMethod · 0.80
GetMethod · 0.45
ErrorMethod · 0.45

Tested by

no test coverage detected