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 methods
pull/1251/head
Roman 2021-03-30 23:31:03 +02:00 committed by GitHub
parent 81c0ec8c0c
commit ca0e784fb9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 18 deletions

View File

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

View File

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