Website: update guaranteed locals in custom hook (#18296)

Closes: #18295

Changes:
- Updated the custom hook to set `res.locals` for HEAD requests to
prevent 500 errors when a request is sent to a page that references
`res.locals.me`
This commit is contained in:
Eric 2024-04-15 19:51:50 -05:00 committed by GitHub
parent 5311aec0fe
commit 5692598143
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -123,9 +123,9 @@ will be disabled and/or hidden in the UI.
var url = require('url');
// First, if this is a GET request (and thus potentially a view),
// First, if this is a GET request (and thus potentially a view) or a HEAD request,
// attach a couple of guaranteed locals.
if (req.method === 'GET') {
if (req.method === 'GET' || req.method === 'HEAD') {
// The `_environment` local lets us do a little workaround to make Vue.js
// run in "production mode" without unnecessarily involving complexities