fix issue in dupicated expiration handling in response cookies og ghttp.Client

This commit is contained in:
John
2020-04-23 21:12:32 +08:00
parent 35a50b9c6c
commit f026686fda

View File

@ -10,7 +10,6 @@ import (
"github.com/gogf/gf/util/gconv"
"io/ioutil"
"net/http"
"time"
)
// ClientResponse is the struct for client request response.
@ -22,12 +21,8 @@ type ClientResponse struct {
// initCookie initializes the cookie map attribute of ClientResponse.
func (r *ClientResponse) initCookie() {
if r.cookies == nil {
now := time.Now()
r.cookies = make(map[string]string)
for _, v := range r.Cookies() {
if v.Expires.UnixNano() < now.UnixNano() {
continue
}
r.cookies[v.Name] = v.Value
}
}