1
0
mirror of synced 2026-01-29 03:03:52 -05:00

Merge pull request #7382 from github/repo-sync

repo sync
This commit is contained in:
Octomerger Bot
2021-06-15 09:33:51 +10:00
committed by GitHub
5 changed files with 18 additions and 1 deletions

View File

@@ -13,7 +13,6 @@ children:
- /about-enterprise-accounts
- /managing-your-github-enterprise-license
- /managing-billing-for-your-enterprise
- /about-upgrades-to-new-releases
- /system-overview
- /about-the-github-enterprise-api
---

View File

@@ -0,0 +1,15 @@
const accept = require('@hapi/accept')
// Next.JS uses the @hapi/accept package to parse and detect languages. If the accept-language header is malformed
// it throws an error from within Next.JS, which results in a 500 response. This ends up being noisy because we
// track 500s. To counteract this, we'll try to catch the error first and make sure it doesn't happen
module.exports = function catchBadAcceptLanguage (req, res, next) {
try {
accept.language(req.headers['accept-language'])
} catch (e) {
// if there's a problem with parsing 'accept-language', just clear it out.
req.headers['accept-language'] = ''
}
return next()
}

View File

@@ -54,6 +54,7 @@ module.exports = function (app) {
app.use(require('compression')())
app.use(require('./disable-caching-on-safari'))
app.use(require('./set-fastly-surrogate-key'))
app.use(require('./catch-bad-accept-language'))
// *** Config and context for redirects ***
app.use(require('./req-utils')) // Must come before record-redirect and events

1
package-lock.json generated
View File

@@ -7,6 +7,7 @@
"name": "docs.github.com",
"license": "(MIT AND CC-BY-4.0)",
"dependencies": {
"@hapi/accept": "^5.0.2",
"@primer/components": "^28.0.4",
"@primer/css": "^16.2.0",
"@primer/octicons": "^14.1.0",

View File

@@ -13,6 +13,7 @@
".next/cache"
],
"dependencies": {
"@hapi/accept": "^5.0.2",
"@primer/components": "^28.0.4",
"@primer/css": "^16.2.0",
"@primer/octicons": "^14.1.0",