mirror of
https://gitee.com/johng/gf
synced 2026-06-06 02:25:47 +08:00
fix issue in dupicated expiration handling in response cookies og ghttp.Client
This commit is contained in:
@ -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
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user