优化代码

This commit is contained in:
刘祥超
2022-08-04 11:41:42 +08:00
parent b8babaae39
commit 0414cc02e8
16 changed files with 38 additions and 44 deletions

View File

@@ -10,7 +10,7 @@ import (
"github.com/TeaOSLab/EdgeAPI/internal/utils"
"github.com/TeaOSLab/EdgeCommon/pkg/rpc/pb"
"github.com/TeaOSLab/EdgeCommon/pkg/serverconfigs"
"io/ioutil"
"io"
"net/http"
"regexp"
"strings"
@@ -118,7 +118,7 @@ func (this *ESStorage) Write(accessLogs []*pb.HTTPAccessLog) error {
}()
if resp.StatusCode != http.StatusOK {
bodyData, _ := ioutil.ReadAll(resp.Body)
bodyData, _ := io.ReadAll(resp.Body)
return errors.New("ElasticSearch response status code: " + fmt.Sprintf("%d", resp.StatusCode) + " content: " + string(bodyData))
}