From 9bbbbf6769f22934d4dd7b93dc946e456d7a4941 Mon Sep 17 00:00:00 2001 From: Gerasimos Maropoulos Date: Mon, 17 Oct 2016 04:43:31 +0300 Subject: [PATCH] StaticEmbedded: Do the actual work if cache duration passed For StaticEmbedded example take a look at the HISTORY.md file --- iris.go | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) 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)