From 333bfaa3b3d5d139aa233f8bcbc08f752fd6227f Mon Sep 17 00:00:00 2001 From: "davidzhang.zc" Date: Fri, 9 Apr 2021 10:45:21 +0800 Subject: [PATCH] [fix] use HTTP Header Get function to replace directly map operation --- log_store.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/log_store.go b/log_store.go index f0cf0382..11b28654 100644 --- a/log_store.go +++ b/log_store.go @@ -505,7 +505,7 @@ func (s *LogStore) GetHistograms(topic string, from int64, to int64, queryExp st return nil, NewBadResponseError(string(body), r.Header, r.StatusCode) } - count, err := strconv.ParseInt(r.Header[GetLogsCountHeader][0], 10, 64) + count, err := strconv.ParseInt(r.Header.Get(GetLogsCountHeader), 10, 64) if err != nil { return nil, err } @@ -553,7 +553,7 @@ func (s *LogStore) getLogs(topic string, from int64, to int64, queryExp string, return nil, nil, nil, err } - count, err := strconv.ParseInt(r.Header[GetLogsCountHeader][0], 10, 32) + count, err := strconv.ParseInt(r.Header.Get(GetLogsCountHeader), 10, 32) if err != nil { return nil, nil, nil, err } @@ -564,7 +564,7 @@ func (s *LogStore) getLogs(topic string, from int64, to int64, queryExp string, } } hasSQL := false - if sqlHeaderArray, ok := r.Header[HasSQLHeader]; ok && len(sqlHeaderArray) > 0 && sqlHeaderArray[0] == "true" { + if r.Header.Get(HasSQLHeader) == "true" { hasSQL = true }