-
Notifications
You must be signed in to change notification settings - Fork 434
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added support for cookie management. Can now add and delete cookies - #…
- Loading branch information
Showing
7 changed files
with
338 additions
and
30 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
23 changes: 23 additions & 0 deletions
23
src/JonnyW/PhantomJs/Resources/procedures/page_cookies.partial
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
|
||
var cookies = {{ input.getCookies()|json_encode() }}; | ||
|
||
cookies.delete.forEach(function(name) { | ||
|
||
if(name == '*') { | ||
page.clearCookies(); | ||
debug.push(new Date().toISOString().slice(0, -5) + ' [INFO] PhantomJS - Deleted all cookies'); | ||
} else { | ||
|
||
if(page.deleteCookie(name)) { | ||
debug.push(new Date().toISOString().slice(0, -5) + ' [INFO] PhantomJS - Deleted cookie ' + name); | ||
} | ||
} | ||
}); | ||
|
||
|
||
cookies.add.forEach(function(cookie) { | ||
|
||
if(page.addCookie(cookie)) { | ||
debug.push(new Date().toISOString().slice(0, -5) + ' [INFO] PhantomJS - Added cookie ' + cookie.name + '=' + cookie.value); | ||
} | ||
}); |
Oops, something went wrong.