Skip to content

Commit

Permalink
Add the HTTPOnly field to Cookie
Browse files Browse the repository at this point in the history
  • Loading branch information
edef1c authored and minusnine committed May 1, 2020
1 parent 1131f5e commit 9a0798f
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 17 deletions.
24 changes: 13 additions & 11 deletions remote.go
Original file line number Diff line number Diff line change
Expand Up @@ -905,12 +905,13 @@ func (wd *remoteWD) ActiveElement() (WebElement, error) {
// ChromeDriver returns the expiration date as a float. Handle both formats
// via a type switch.
type cookie struct {
Name string `json:"name"`
Value string `json:"value"`
Path string `json:"path"`
Domain string `json:"domain"`
Secure bool `json:"secure"`
Expiry interface{} `json:"expiry"`
Name string `json:"name"`
Value string `json:"value"`
Path string `json:"path"`
Domain string `json:"domain"`
Secure bool `json:"secure"`
Expiry interface{} `json:"expiry"`
HTTPOnly bool `json:"httpOnly"`
}

func (c cookie) sanitize() Cookie {
Expand Down Expand Up @@ -984,11 +985,12 @@ func (wd *remoteWD) GetCookies() ([]Cookie, error) {
cookies := make([]Cookie, len(reply.Value))
for i, c := range reply.Value {
sanitized := Cookie{
Name: c.Name,
Value: c.Value,
Path: c.Path,
Domain: c.Domain,
Secure: c.Secure,
Name: c.Name,
Value: c.Value,
Path: c.Path,
Domain: c.Domain,
Secure: c.Secure,
HTTPOnly: c.HTTPOnly,
}
switch expiry := c.Expiry.(type) {
case int:
Expand Down
13 changes: 7 additions & 6 deletions selenium.go
Original file line number Diff line number Diff line change
Expand Up @@ -203,12 +203,13 @@ type Size struct {

// Cookie represents an HTTP cookie.
type Cookie struct {
Name string `json:"name"`
Value string `json:"value"`
Path string `json:"path"`
Domain string `json:"domain"`
Secure bool `json:"secure"`
Expiry uint `json:"expiry"`
Name string `json:"name"`
Value string `json:"value"`
Path string `json:"path"`
Domain string `json:"domain"`
Secure bool `json:"secure"`
Expiry uint `json:"expiry"`
HTTPOnly bool `json:"httpOnly"`
}

// WebDriver defines methods supported by WebDriver drivers.
Expand Down

0 comments on commit 9a0798f

Please sign in to comment.