mirror of
https://github.com/kataras/iris.git
synced 2025-12-17 18:07:01 +00:00
Add one more browser (and 304 server) cache method using ETag and If-None-Match headers
And replace the 'ctx.WriteWithExpiration' with simple 'ctx.Write' at 'StaticEmbeddedHandler' of core/router/fs.go, now that we have plenty of options for client cache give the end-dev the oportunity to use them or not on static embedded handlers Former-commit-id: 9c9e2f3de3c5ad8c9e14e453b67e6b649b02bde8
This commit is contained in:
@@ -68,7 +68,7 @@ func StaticEmbeddedHandler(vdir string, assetFn func(name string) ([]byte, error
|
||||
names = append(names, path)
|
||||
}
|
||||
|
||||
modtime := time.Now()
|
||||
// modtime := time.Now()
|
||||
h := func(ctx context.Context) {
|
||||
|
||||
reqPath := strings.TrimPrefix(ctx.Request().URL.Path, "/"+vdir)
|
||||
@@ -100,7 +100,7 @@ func StaticEmbeddedHandler(vdir string, assetFn func(name string) ([]byte, error
|
||||
}
|
||||
|
||||
ctx.ContentType(cType)
|
||||
if _, err := ctx.WriteWithExpiration(buf, modtime); err != nil {
|
||||
if _, err := ctx.Write(buf); err != nil {
|
||||
ctx.StatusCode(http.StatusInternalServerError)
|
||||
ctx.StopExecution()
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user