From 8cf7aff6c3fb5e1884f908fb35d4db760bf1ba04 Mon Sep 17 00:00:00 2001 From: Edo Date: Tue, 10 Jan 2017 23:19:10 +0100 Subject: [PATCH] Allow overriding render options See #722 as well, but I can imagine more use cases. --- server/index.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/server/index.js b/server/index.js index f50c6779c1a44..eb669a7913a43 100644 --- a/server/index.js +++ b/server/index.js @@ -123,7 +123,7 @@ export default class Server { sendHTML(res, html) } - async renderToHTML (req, res, pathname, query) { + async renderToHTML (req, res, pathname, query, opts = {}) { if (this.dev) { const compilationErr = this.getCompilationError(pathname) if (compilationErr) { @@ -131,9 +131,11 @@ export default class Server { return this.renderErrorToHTML(compilationErr, req, res, pathname, query) } } + + const _opts = Object.assign(this.renderOpts, opts) try { - return await renderToHTML(req, res, pathname, query, this.renderOpts) + return await renderToHTML(req, res, pathname, query, _opts) } catch (err) { if (err.code === 'ENOENT') { res.statusCode = 404