From 7beb2ff697f6fccdfd78884e221076a570974e7f Mon Sep 17 00:00:00 2001 From: Dron Rathore Date: Wed, 21 Jun 2017 19:09:15 +0530 Subject: [PATCH] [Major] make GetRaw working and add a feature to Cookie package (#16) [Major] make GetRaw working and add a cookie method * Request.GetRaw() seems to be broken from the beginning is now been fixed. * Cookies package now has a new method GetAll() which returns a map of type map[string]*http.Cookie --- cookie/cookie.go | 7 ++++++- request/request.go | 1 + 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/cookie/cookie.go b/cookie/cookie.go index 3cef98d..13d06bf 100644 --- a/cookie/cookie.go +++ b/cookie/cookie.go @@ -74,6 +74,11 @@ func (c *Cookie) Get(name string) string{ return cookie.Value } +// Returns the map of all the cookies +func (c *Cookie) GetAll() map[string]*http.Cookie { + return c.cookies +} + // An internal function to set all the cookies before pushing response body func (c *Cookie) Finish(){ if c.readonly { @@ -84,4 +89,4 @@ func (c *Cookie) Finish(){ c.response.AddCookie("Set-Cookie", v) } } -} \ No newline at end of file +} diff --git a/request/request.go b/request/request.go index 7d2f6ef..39adedb 100644 --- a/request/request.go +++ b/request/request.go @@ -49,6 +49,7 @@ func (req *Request) Init(request *http.Request, props *map[string]interface{}) * req.Header = make(map[string]string) req.Body = make(map[string][]string) req.Body = request.Form + req.ref = request req.Cookies = &cookie.Cookie{} req.Cookies.InitReadOnly(request) req.Query = make(map[string][]string)