diff --git a/lib/app/index.js b/lib/app/index.js index 2789372..4430848 100644 --- a/lib/app/index.js +++ b/lib/app/index.js @@ -44,11 +44,6 @@ const configureApplication = ({ app.use(forceSecure) } - if (appLogger) { - app.post('/download/html', downloadHTML(appLogger)) - app.post('/download', download(appLogger)) - } - // Server logs You can alternatively enable these to mimic logs created // by your web server if (routeLogger) { @@ -83,6 +78,9 @@ const configureApplication = ({ }) } + app.use('/download/html', checkURLParameter) + app.use('/download', checkURLParameter) + app.get('/error', error) app.get('/about', (req, res) => { @@ -92,9 +90,9 @@ const configureApplication = ({ // NOTE: Capture all unkown URLs app.get('*', notFound) - app.use('/download/html', checkURLParameter) - - app.use('/download', checkURLParameter) + app.post('/download/html', downloadHTML(appLogger || null)) + app.post('/download', download(appLogger || null)) + app.use(genericErrorHandler) diff --git a/lib/static/index.js b/lib/static/index.js index 05f2835..bd0a4f5 100644 --- a/lib/static/index.js +++ b/lib/static/index.js @@ -171,7 +171,7 @@ import generateICS from '../../lib/services/ics-generator' const postURL = (data) => { return new Promise((resolve, reject) => { - fetch('/download/html', { + fetch('/download/html/', { method: 'POST', headers: { 'Accept': 'text/html, application/json',