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

Function TestContextFileNotFound

context_file_test.go:27–35  ·  view source on GitHub ↗

TestContextFileNotFound tests serving a non-existent file

(t *testing.T)

Source from the content-addressed store, hash-verified

25
26// TestContextFileNotFound tests serving a non-existent file
27func TestContextFileNotFound(t *testing.T) {
28 w := httptest.NewRecorder()
29 c, _ := CreateTestContext(w)
30 c.Request = httptest.NewRequest(http.MethodGet, "/test", nil)
31
32 c.File("non_existent_file.txt")
33
34 assert.Equal(t, http.StatusNotFound, w.Code)
35}

Callers

nothing calls this directly

Calls 2

CreateTestContextFunction · 0.85
FileMethod · 0.80

Tested by

no test coverage detected