mirror of https://github.com/gofiber/fiber.git
Refactor cache middleware to not-use the deprecated methods (#1246)
* ♻️ refactor: cache: don't use the deprecated `SafeBytes` and use `CopyBytes` instead * ♻️ refactor: utils: remove deprecated and unused methodspull/1251/head
parent
81c0ec8c0c
commit
ca0e784fb9
|
@ -102,10 +102,10 @@ func New(config ...Config) fiber.Handler {
|
|||
}
|
||||
|
||||
// Cache response
|
||||
e.body = utils.SafeBytes(c.Response().Body())
|
||||
e.body = utils.CopyBytes(c.Response().Body())
|
||||
e.status = c.Response().StatusCode()
|
||||
e.ctype = utils.SafeBytes(c.Response().Header.ContentType())
|
||||
e.cencoding = utils.SafeBytes(c.Response().Header.Peek(fiber.HeaderContentEncoding))
|
||||
e.ctype = utils.CopyBytes(c.Response().Header.ContentType())
|
||||
e.cencoding = utils.CopyBytes(c.Response().Header.Peek(fiber.HeaderContentEncoding))
|
||||
e.exp = ts + expiration
|
||||
|
||||
// For external Storage we store raw body seperated
|
||||
|
|
|
@ -16,18 +16,3 @@ func GetBytes(s string) []byte {
|
|||
func ImmutableString(s string) string {
|
||||
return CopyString(s)
|
||||
}
|
||||
|
||||
// DEPRECATED, please use EqualFoldBytes
|
||||
func EqualsFold(b, s []byte) (equals bool) {
|
||||
return EqualFoldBytes(b, s)
|
||||
}
|
||||
|
||||
// DEPRECATED, Please use CopyString instead
|
||||
func SafeString(s string) string {
|
||||
return CopyString(s)
|
||||
}
|
||||
|
||||
// DEPRECATED, Please use CopyBytes instead
|
||||
func SafeBytes(b []byte) []byte {
|
||||
return CopyBytes(b)
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue