mirror of
https://github.com/kataras/iris.git
synced 2026-01-10 13:35:59 +00:00
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:
18
iris.go
18
iris.go
@@ -1960,15 +1960,6 @@ func (api *muxAPI) StaticEmbedded(requestPath string, vdir string, assetFn func(
|
|||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
cType := fs.TypeByExtension(path)
|
|
||||||
fullpath := vdir + path
|
|
||||||
|
|
||||||
buf, err := assetFn(fullpath)
|
|
||||||
|
|
||||||
if err != nil {
|
|
||||||
continue
|
|
||||||
}
|
|
||||||
|
|
||||||
if modtimeStr == "" {
|
if modtimeStr == "" {
|
||||||
modtimeStr = modtime.UTC().Format(ctx.framework.Config.TimeFormat)
|
modtimeStr = modtime.UTC().Format(ctx.framework.Config.TimeFormat)
|
||||||
}
|
}
|
||||||
@@ -1980,6 +1971,15 @@ func (api *muxAPI) StaticEmbedded(requestPath string, vdir string, assetFn func(
|
|||||||
return
|
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(contentType, cType)
|
||||||
ctx.Response.Header.Set(lastModified, modtimeStr)
|
ctx.Response.Header.Set(lastModified, modtimeStr)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user