fix issue 1162
@@ -25,11 +25,14 @@ type Response struct {
func (r *Response) initCookie() {
if r.cookies == nil {
r.cookies = make(map[string]string)
+ // Response might be nil.
+ if r != nil && r.Response != nil {
for _, v := range r.Cookies() {
r.cookies[v.Name] = v.Value
}
}
}
+}
// GetCookie retrieves and returns the cookie value of specified <key>.
func (r *Response) GetCookie(key string) string {
