From 4690231fc2937b3332d4a3db2982de2f87bc3dfd Mon Sep 17 00:00:00 2001 From: jirkakrepl Date: Fri, 14 Jan 2022 20:20:43 +0100 Subject: [PATCH] fix: show users-agent from correct request --- .gitignore | 3 ++- index.js | 2 +- package.json | 2 +- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/.gitignore b/.gitignore index 28f1ba7..464c9c0 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,3 @@ node_modules -.DS_Store \ No newline at end of file +.DS_Store +/.idea/ diff --git a/index.js b/index.js index 2eb2eb2..287e47b 100644 --- a/index.js +++ b/index.js @@ -29,7 +29,7 @@ var prerender = module.exports = function(req, res, next) { if(prerenderedResponse){ res.writeHead(prerenderedResponse.statusCode, prerenderedResponse.headers); - console.log(`pre-rendered response ${prerenderedResponse.statusCode} for: ${prerenderedResponse.headers['user-agent']}`); + console.log(`pre-rendered response ${prerenderedResponse.statusCode} for: ${req.headers['user-agent']}`); return res.end(prerenderedResponse.body); } else { next(err); diff --git a/package.json b/package.json index 7528d1a..3944f88 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@jirkakrepl/prerender-node", - "version": "3.4.1", + "version": "3.4.2", "description": "express middleware for serving prerendered javascript-rendered pages for SEO", "author": "Todd Hooper", "license": "MIT",