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

Function TestLoadHTMLGlobUsingTLS

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

Source from the content-addressed store, hash-verified

161}
162
163func TestLoadHTMLGlobUsingTLS(t *testing.T) {
164 ts := setupHTMLFiles(
165 t,
166 DebugMode,
167 true,
168 func(router *Engine) {
169 router.LoadHTMLGlob("./testdata/template/*")
170 },
171 )
172 defer ts.Close()
173
174 // Use InsecureSkipVerify for avoiding `x509: certificate signed by unknown authority` error
175 tr := &http.Transport{
176 TLSClientConfig: &tls.Config{
177 InsecureSkipVerify: true,
178 },
179 }
180 client := &http.Client{Transport: tr}
181 res, err := client.Get(ts.URL + "/test")
182 if err != nil {
183 t.Error(err)
184 }
185
186 resp, _ := io.ReadAll(res.Body)
187 assert.Equal(t, "<h1>Hello world</h1>", string(resp))
188}
189
190func TestLoadHTMLGlobFromFuncMap(t *testing.T) {
191 ts := setupHTMLFiles(

Callers

nothing calls this directly

Calls 5

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

Tested by

no test coverage detected