StaticEmbedded: Do the actual work if cache duration passed

For StaticEmbedded example take a look at the HISTORY.md file
This commit is contained in:
Gerasimos Maropoulos 2016-10-17 04:43:31 +03:00
parent 1a913d45d4
commit 9bbbbf6769

18
iris.go
View File

@ -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)