Browse Source

response cookie

ls 5 years ago
parent
commit
7518425275
1 changed files with 3 additions and 0 deletions
  1. 3 0
      http.go

+ 3 - 0
http.go

@@ -37,6 +37,7 @@ type Message struct {
 	StatusCode int
 	Body       []byte
 	Header     http.Header
+	Cookies    []*http.Cookie
 }
 
 func header(w http.ResponseWriter, contentType string) {
@@ -215,6 +216,7 @@ func Post(uri, certPath, keyPath string, header map[string]string, data io.Reade
 	}
 	defer res.Body.Close()
 	msg, err = readBody(res)
+	msg.Cookies = res.Cookies()
 	return
 }
 
@@ -227,6 +229,7 @@ func Get(uri, certPath, keyPath string, header map[string]string) (msg Message,
 
 	defer res.Body.Close()
 	msg, err = readBody(res)
+	msg.Cookies = res.Cookies()
 	return
 }