Skip to content

Instantly share code, notes, and snippets.

@areai51
Created March 23, 2019 03:43
Show Gist options
  • Select an option

  • Save areai51/489c50b29b5c231a92b99ce75043d03b to your computer and use it in GitHub Desktop.

Select an option

Save areai51/489c50b29b5c231a92b99ce75043d03b to your computer and use it in GitHub Desktop.
const path = require('path');
const fetchTemplateFs = require('node-tailor/lib/fetch-template');
const ACCEPT_HEADERS = [
'accept-language',
'referer',
'user-agent',
'x-request-uri',
'x-request-host',
'cookie',
];
module.exports = {
fetchTemplate: fetchTemplateFs(
path.join(__dirname, '../..', 'templates'),
() => 'app-shell',
),
filterRequestHeaders: (attributes, request) => {
const { public: publicFragment } = attributes;
const { headers = {} } = request;
return publicFragment
? {}
: ACCEPT_HEADERS.reduce((newHeaders, key) => {
headers[key] && (newHeaders[key] = headers[key]);
return newHeaders;
}, {});
},
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment