diff --git a/iris.go b/iris.go index 045824a8..d58e6d02 100644 --- a/iris.go +++ b/iris.go @@ -1960,15 +1960,6 @@ func (api *muxAPI) StaticEmbedded(requestPath string, vdir string, assetFn func( continue } - cType := fs.TypeByExtension(path) - fullpath := vdir + path - - buf, err := assetFn(fullpath) - - if err != nil { - continue - } - if modtimeStr == "" { modtimeStr = modtime.UTC().Format(ctx.framework.Config.TimeFormat) } @@ -1980,6 +1971,15 @@ func (api *muxAPI) StaticEmbedded(requestPath string, vdir string, assetFn func( return } + cType := fs.TypeByExtension(path) + fullpath := vdir + path + + buf, err := assetFn(fullpath) + + if err != nil { + continue + } + ctx.Response.Header.Set(contentType, cType) ctx.Response.Header.Set(lastModified, modtimeStr)