From 28d28cb8c1edfeddb13b95883ae0e644b462c2c6 Mon Sep 17 00:00:00 2001 From: Clark Du Date: Sun, 4 Feb 2018 00:43:29 +0800 Subject: [PATCH] feature: pass request to render:route hook --- examples/with-amp/nuxt.config.js | 2 +- lib/core/middleware/nuxt.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/examples/with-amp/nuxt.config.js b/examples/with-amp/nuxt.config.js index f45837119e..75986508b4 100644 --- a/examples/with-amp/nuxt.config.js +++ b/examples/with-amp/nuxt.config.js @@ -31,7 +31,7 @@ module.exports = { page.html = modifyHtml(page.html) }, // This hook is called before rendering the html to the browser - 'render:route': (url, page) => { + 'render:route': (req, page) => { page.html = modifyHtml(page.html) } } diff --git a/lib/core/middleware/nuxt.js b/lib/core/middleware/nuxt.js index bc80a99bcf..3ab2be4bfb 100644 --- a/lib/core/middleware/nuxt.js +++ b/lib/core/middleware/nuxt.js @@ -10,7 +10,7 @@ module.exports = async function nuxtMiddleware(req, res, next) { res.statusCode = 200 try { const result = await this.renderRoute(req.url, context) - await this.nuxt.callHook('render:route', req.url, result) + await this.nuxt.callHook('render:route', req, result) const { html, cspScriptSrcHashes,