build: don't use ioutil

This is deprecated.
This commit is contained in:
Vincent Bernat
2023-11-12 22:54:44 +01:00
parent 9cfa8e0da5
commit 9db516e424
9 changed files with 20 additions and 24 deletions

View File

@@ -6,7 +6,7 @@ package httpserver
import (
"bytes"
"crypto"
"io/ioutil"
"io"
"time"
cache "github.com/chenyahui/gin-cache"
@@ -31,7 +31,7 @@ func (c *Component) CacheByRequestBody(expire time.Duration) gin.HandlerFunc {
opts := c.commonCacheOptions()
opts = append(opts, cache.WithCacheStrategyByRequest(func(gc *gin.Context) (bool, cache.Strategy) {
requestBody, err := gc.GetRawData()
gc.Request.Body = ioutil.NopCloser(bytes.NewBuffer(requestBody))
gc.Request.Body = io.NopCloser(bytes.NewBuffer(requestBody))
if err != nil {
return false, cache.Strategy{}
}