We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent d8ea93c commit 4b15a12Copy full SHA for 4b15a12
src/core/render-core.js
@@ -152,6 +152,8 @@ async function render(_opts = {}) {
152
153
if (opts.output === 'pdf') {
154
data = await page.pdf(opts.pdf);
155
+ } else if (opts.output === 'html') {
156
+ data = await page.evaluate(() => document.body.innerHTML);
157
} else {
158
// This is done because puppeteer throws an error if fullPage and clip is used at the same
159
// time even though clip is just empty object {}
src/http/render-http.js
@@ -5,7 +5,10 @@ const renderCore = require('../core/render-core');
5
function getMimeType(opts) {
6
7
return 'application/pdf';
8
9
+ return 'text/html';
10
}
11
+
12
const type = _.get(opts, 'screenshot.type');
13
switch (type) {
14
case 'png': return 'image/png';
src/util/validation.js
@@ -29,7 +29,7 @@ const sharedQuerySchema = Joi.object({
29
Joi.string().min(1).max(2000),
30
]),
31
cookies: Joi.array().items(cookieSchema),
32
- output: Joi.string().valid(['pdf', 'screenshot']),
+ output: Joi.string().valid(['pdf', 'screenshot', 'html']),
33
'viewport.width': Joi.number().min(1).max(30000),
34
'viewport.height': Joi.number().min(1).max(30000),
35
'viewport.deviceScaleFactor': Joi.number().min(0).max(100),
@@ -76,7 +76,7 @@ const renderBodyObject = Joi.object({
76
ignoreHttpsErrors: Joi.boolean(),
77
emulateScreenMedia: Joi.boolean(),
78
79
80
viewport: Joi.object({
81
width: Joi.number().min(1).max(30000),
82
height: Joi.number().min(1).max(30000),
0 commit comments