Skip to content

Commit 84ac0a2

Browse files
seyfertmarcbachmann
authored andcommitted
Add http cookie support
1 parent 6830076 commit 84ac0a2

File tree

2 files changed

+15
-0
lines changed

2 files changed

+15
-0
lines changed

README.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -149,6 +149,20 @@ config = {
149149
"detached": true
150150
}
151151

152+
// HTTP Cookies that are used for requests
153+
"httpCookies": [
154+
// e.g.
155+
{
156+
"name": "Valid-Cookie-Name", // required
157+
"value": "Valid-Cookie-Value", // required
158+
"domain": "localhost",
159+
"path": "/foo", // required
160+
"httponly": true,
161+
"secure": false,
162+
"expires": (new Date()).getTime() + (1000 * 60 * 60) // e.g. expires in 1 hour
163+
}
164+
]
165+
152166
}
153167
```
154168

lib/scripts/pdf_a4_portrait.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,7 @@ function renderNow () {
7272

7373
// Set Content and begin loading
7474
// -----------------------------
75+
if (options.httpCookies) page.cookies = options.httpCookies
7576
if (options.httpHeaders) page.customHeaders = options.httpHeaders
7677
if (options.viewportSize) page.viewportSize = options.viewportSize
7778
if (options.zoomFactor) page.zoomFactor = options.zoomFactor

0 commit comments

Comments
 (0)