lib/grover/processor.rb in grover-0.1.2 vs lib/grover/processor.rb in grover-0.2.0
- old
+ new
@@ -16,10 +16,14 @@
async (url, options) => {
let browser;
try {
browser = await puppeteer.launch(#{launch_params});
const page = await browser.newPage();
- await page.goto(url, { waitUntil: 'networkidle2' });
+ if (url.match(/^http/i)) {
+ await page.goto(url, { waitUntil: 'networkidle2' });
+ } else {
+ await page.setContent(url);
+ }
return await page.pdf(options);
} finally {
if (browser) {
await browser.close();
}