浏览代码

response cookie

ls 6 年之前
父节点
当前提交
7518425275
共有 1 个文件被更改,包括 3 次插入0 次删除
  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
 }