1
0
mirror of https://github.com/gofiber/fiber.git synced 2025-02-23 19:44:02 +00:00

🩹 fix race condition

This commit is contained in:
Fenny 2020-10-29 06:38:41 +01:00
parent 79c151c238
commit 70d7c53557
2 changed files with 5 additions and 2 deletions

View File

@ -178,8 +178,12 @@ func New(config ...Config) fiber.Handler {
}
} else {
// Set response headers from cache
if cfg.defaultStore {
c.Response().SetBodyRaw(entry.body)
} else {
c.Response().SetBodyRaw(entryBody)
}
// Set response headers from cache
c.Response().SetStatusCode(entry.status)
c.Response().Header.SetContentTypeBytes(entry.cType)

View File

@ -311,7 +311,6 @@ func (s testStore) Set(id string, val []byte, _ time.Duration) error {
s.mutex.Lock()
s.stmap[id] = val
s.mutex.Unlock()
return nil
}