MCPcopy Index your code
hub / github.com/kataras/iris / TestFileServerBasic

Function TestFileServerBasic

_examples/file-server/basic/main_test.go:60–94  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

58}
59
60func TestFileServerBasic(t *testing.T) {
61 urls := []resource{
62 "/v1/static/css/main.css",
63 "/v1/static/js/main.js",
64 "/v1/static/favicon.ico",
65 "/v1/static/app2",
66 "/v1/static/app2/app2app3",
67 "/v1/static",
68 }
69
70 app := newApp()
71 // route := app.GetRouteReadOnly("GET/{file:path}")
72 // if route == nil {
73 // app.Logger().Fatalf("expected a route to serve files")
74 // }
75
76 // if expected, got := "./assets", route.StaticDir(); expected != got {
77 // app.Logger().Fatalf("expected route's static directory to be: '%s' but got: '%s'", expected, got)
78 // }
79
80 // if !route.StaticDirContainsIndex() {
81 // app.Logger().Fatalf("epxected ./assets to contain an %s file", "/index.html")
82 // }
83
84 e := httptest.New(t, app)
85 for _, u := range urls {
86 url := u.String()
87 contents := u.loadFromBase("./assets", "/v1/static")
88
89 e.GET(url).Expect().
90 Status(httptest.StatusOK).
91 ContentType(u.contentType(), app.ConfigurationReadOnly().GetCharset()).
92 Body().IsEqual(contents)
93 }
94}
95
96// Tests subdomain + request path and system directory with a name that contains a dot(.)
97func TestHandleDirDot(t *testing.T) {

Callers

nothing calls this directly

Calls 10

NewFunction · 0.92
StatusMethod · 0.80
newAppFunction · 0.70
StringMethod · 0.65
BodyMethod · 0.65
GetCharsetMethod · 0.65
ConfigurationReadOnlyMethod · 0.65
loadFromBaseMethod · 0.45
ContentTypeMethod · 0.45
contentTypeMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…