Skip to content

Commit

Permalink
[Major] make GetRaw working and add a feature to Cookie package (#16)
Browse files Browse the repository at this point in the history
[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
  • Loading branch information
DronRathore authored Jun 21, 2017
1 parent fc5eac7 commit 7beb2ff
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
7 changes: 6 additions & 1 deletion cookie/cookie.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -84,4 +89,4 @@ func (c *Cookie) Finish(){
c.response.AddCookie("Set-Cookie", v)
}
}
}
}
1 change: 1 addition & 0 deletions request/request.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 7beb2ff

Please sign in to comment.