1
0
mirror of synced 2025-12-23 11:54:18 -05:00

rest reference redirects with free-pro-team@latest (#28838)

This commit is contained in:
Peter Bengtsson
2022-06-29 22:42:58 +02:00
committed by GitHub
parent 5b0e38817d
commit ef5406ae9a
2 changed files with 51 additions and 30 deletions

View File

@@ -597,12 +597,10 @@
"/enterprise-server@2.20/v3/troubleshooting": "/enterprise-server@2.20/rest/overview/troubleshooting",
"/enterprise/2.20/v3/troubleshooting": "/enterprise-server@2.20/rest/overview/troubleshooting",
"/github-ae@latest/v3/troubleshooting": "/github-ae@latest/rest/overview/troubleshooting",
"/free-pro-team@latest/rest/reference/actions": "/rest/reference/actions",
"/v3/actions": "/rest/actions",
"/free-pro-team@latest/v3/actions": "/rest/reference/actions",
"/enterprise/rest/reference/actions": "/enterprise-server@latest/rest/reference/actions",
"/enterprise/v3/actions": "/enterprise-server@latest/rest/reference/actions",
"/free-pro-team@latest/rest/reference/activity": "/rest/reference/activity",
"/v3/activity": "/rest/activity",
"/free-pro-team@latest/v3/activity": "/rest/reference/activity",
"/enterprise/rest/reference/activity": "/enterprise-server@latest/rest/reference/activity",
@@ -611,7 +609,6 @@
"/enterprise-server@2.20/v3/activity": "/enterprise-server@2.20/rest/reference/activity",
"/enterprise/2.20/v3/activity": "/enterprise-server@2.20/rest/reference/activity",
"/github-ae@latest/v3/activity": "/github-ae@latest/rest/reference/activity",
"/free-pro-team@latest/rest/reference/apps": "/rest/reference/apps",
"/v3/apps": "/rest/apps",
"/free-pro-team@latest/v3/apps": "/rest/reference/apps",
"/enterprise/rest/reference/apps": "/enterprise-server@latest/rest/reference/apps",
@@ -620,8 +617,6 @@
"/enterprise-server@2.20/v3/apps": "/enterprise-server@2.20/rest/reference/apps",
"/enterprise/2.20/v3/apps": "/enterprise-server@2.20/rest/reference/apps",
"/github-ae@latest/v3/apps": "/github-ae@latest/rest/reference/apps",
"/free-pro-team@latest/rest/reference/billing": "/rest/reference/billing",
"/free-pro-team@latest/rest/reference/checks": "/rest/reference/checks",
"/v3/checks": "/rest/checks",
"/free-pro-team@latest/v3/checks": "/rest/reference/checks",
"/enterprise/rest/reference/checks": "/enterprise-server@latest/rest/reference/checks",
@@ -630,12 +625,10 @@
"/enterprise-server@2.20/v3/checks": "/enterprise-server@2.20/rest/reference/checks",
"/enterprise/2.20/v3/checks": "/enterprise-server@2.20/rest/reference/checks",
"/github-ae@latest/v3/checks": "/github-ae@latest/rest/reference/checks",
"/free-pro-team@latest/rest/reference/code-scanning": "/rest/reference/code-scanning",
"/v3/code-scanning": "/rest/code-scanning",
"/free-pro-team@latest/v3/code-scanning": "/rest/reference/code-scanning",
"/enterprise/rest/reference/code-scanning": "/enterprise-server@latest/rest/reference/code-scanning",
"/enterprise/v3/code-scanning": "/enterprise-server@latest/rest/reference/code-scanning",
"/free-pro-team@latest/rest/reference/codes-of-conduct": "/rest/reference/codes-of-conduct",
"/v3/codes_of_conduct": "/rest/codes-of-conduct",
"/free-pro-team@latest/v3/codes_of_conduct": "/rest/reference/codes-of-conduct",
"/v3/codes-of-conduct": "/rest/codes-of-conduct",
@@ -650,7 +643,6 @@
"/enterprise/2.20/v3/codes-of-conduct": "/enterprise-server@2.20/rest/reference/codes-of-conduct",
"/github-ae@latest/v3/codes_of_conduct": "/github-ae@latest/rest/reference/codes-of-conduct",
"/github-ae@latest/v3/codes-of-conduct": "/github-ae@latest/rest/reference/codes-of-conduct",
"/free-pro-team@latest/rest/reference/emojis": "/rest/reference/emojis",
"/v3/emojis": "/rest/emojis",
"/free-pro-team@latest/v3/emojis": "/rest/reference/emojis",
"/v3/misc": "/rest/emojis",
@@ -680,7 +672,6 @@
"/enterprise/2.20/v3/enterprise": "/enterprise-server@2.20/rest/reference/enterprise-admin",
"/github-ae@latest/v3/enterprise-admin": "/github-ae@latest/rest/reference/enterprise-admin",
"/github-ae@latest/v3/enterprise": "/github-ae@latest/rest/reference/enterprise-admin",
"/free-pro-team@latest/rest/reference/gists": "/rest/reference/gists",
"/v3/gists": "/rest/gists",
"/free-pro-team@latest/v3/gists": "/rest/reference/gists",
"/enterprise/rest/reference/gists": "/enterprise-server@latest/rest/reference/gists",
@@ -689,7 +680,6 @@
"/enterprise-server@2.20/v3/gists": "/enterprise-server@2.20/rest/reference/gists",
"/enterprise/2.20/v3/gists": "/enterprise-server@2.20/rest/reference/gists",
"/github-ae@latest/v3/gists": "/github-ae@latest/rest/reference/gists",
"/free-pro-team@latest/rest/reference/git": "/rest/reference/git",
"/v3/git": "/rest/git",
"/free-pro-team@latest/v3/git": "/rest/reference/git",
"/enterprise/rest/reference/git": "/enterprise-server@latest/rest/reference/git",
@@ -698,7 +688,6 @@
"/enterprise-server@2.20/v3/git": "/enterprise-server@2.20/rest/reference/git",
"/enterprise/2.20/v3/git": "/enterprise-server@2.20/rest/reference/git",
"/github-ae@latest/v3/git": "/github-ae@latest/rest/reference/git",
"/free-pro-team@latest/rest/reference/gitignore": "/rest/reference/gitignore",
"/v3/gitignore": "/rest/gitignore",
"/free-pro-team@latest/v3/gitignore": "/rest/reference/gitignore",
"/enterprise/rest/reference/gitignore": "/enterprise-server@latest/rest/reference/gitignore",
@@ -710,10 +699,8 @@
"/free-pro-team@latest/rest/reference": "/rest/reference",
"/enterprise/rest/reference": "/enterprise-server@latest/rest/reference",
"/enterprise/2.20/rest/reference": "/enterprise-server@2.20/rest/reference",
"/free-pro-team@latest/rest/reference/interactions": "/rest/reference/interactions",
"/v3/interactions": "/rest/interactions",
"/free-pro-team@latest/v3/interactions": "/rest/reference/interactions",
"/free-pro-team@latest/rest/reference/issues": "/rest/reference/issues",
"/v3/issues": "/rest/issues",
"/free-pro-team@latest/v3/issues": "/rest/reference/issues",
"/enterprise/rest/reference/issues": "/enterprise-server@latest/rest/reference/issues",
@@ -722,7 +709,6 @@
"/enterprise-server@2.20/v3/issues": "/enterprise-server@2.20/rest/reference/issues",
"/enterprise/2.20/v3/issues": "/enterprise-server@2.20/rest/reference/issues",
"/github-ae@latest/v3/issues": "/github-ae@latest/rest/reference/issues",
"/free-pro-team@latest/rest/reference/licenses": "/rest/reference/licenses",
"/v3/licenses": "/rest/licenses",
"/free-pro-team@latest/v3/licenses": "/rest/reference/licenses",
"/enterprise/rest/reference/licenses": "/enterprise-server@latest/rest/reference/licenses",
@@ -731,7 +717,6 @@
"/enterprise-server@2.20/v3/licenses": "/enterprise-server@2.20/rest/reference/licenses",
"/enterprise/2.20/v3/licenses": "/enterprise-server@2.20/rest/reference/licenses",
"/github-ae@latest/v3/licenses": "/github-ae@latest/rest/reference/licenses",
"/free-pro-team@latest/rest/reference/markdown": "/rest/reference/markdown",
"/v3/markdown": "/rest/markdown",
"/free-pro-team@latest/v3/markdown": "/rest/reference/markdown",
"/enterprise/rest/reference/markdown": "/enterprise-server@latest/rest/reference/markdown",
@@ -740,7 +725,6 @@
"/enterprise-server@2.20/v3/markdown": "/enterprise-server@2.20/rest/reference/markdown",
"/enterprise/2.20/v3/markdown": "/enterprise-server@2.20/rest/reference/markdown",
"/github-ae@latest/v3/markdown": "/github-ae@latest/rest/reference/markdown",
"/free-pro-team@latest/rest/reference/meta": "/rest/reference/meta",
"/v3/meta": "/rest/meta",
"/free-pro-team@latest/v3/meta": "/rest/reference/meta",
"/enterprise/rest/reference/meta": "/enterprise-server@latest/rest/reference/meta",
@@ -749,7 +733,6 @@
"/enterprise-server@2.20/v3/meta": "/enterprise-server@2.20/rest/reference/meta",
"/enterprise/2.20/v3/meta": "/enterprise-server@2.20/rest/reference/meta",
"/github-ae@latest/v3/meta": "/github-ae@latest/rest/reference/meta",
"/free-pro-team@latest/rest/reference/migrations": "/rest/reference/migrations",
"/v3/migrations": "/rest/migrations",
"/free-pro-team@latest/v3/migrations": "/rest/reference/migrations",
"/v3/migration": "/rest/migrations",
@@ -764,7 +747,6 @@
"/enterprise/2.20/v3/oauth_authorizations": "/enterprise-server@2.20/rest/reference/oauth-authorizations",
"/enterprise-server@2.20/v3/oauth-authorizations": "/enterprise-server@2.20/rest/reference/oauth-authorizations",
"/enterprise/2.20/v3/oauth-authorizations": "/enterprise-server@2.20/rest/reference/oauth-authorizations",
"/free-pro-team@latest/rest/reference/orgs": "/rest/reference/orgs",
"/v3/orgs": "/rest/orgs",
"/free-pro-team@latest/v3/orgs": "/rest/reference/orgs",
"/enterprise/rest/reference/orgs": "/enterprise-server@latest/rest/reference/orgs",
@@ -782,7 +764,6 @@
"/enterprise-server@2.20/v3/apps/permissions": "/enterprise-server@2.20/rest/reference/permissions-required-for-github-apps",
"/enterprise/2.20/v3/apps/permissions": "/enterprise-server@2.20/rest/reference/permissions-required-for-github-apps",
"/github-ae@latest/v3/apps/permissions": "/github-ae@latest/rest/reference/permissions-required-for-github-apps",
"/free-pro-team@latest/rest/reference/projects": "/rest/reference/projects",
"/v3/projects": "/rest/projects",
"/free-pro-team@latest/v3/projects": "/rest/reference/projects",
"/enterprise/rest/reference/projects": "/enterprise-server@latest/rest/reference/projects",
@@ -791,7 +772,6 @@
"/enterprise-server@2.20/v3/projects": "/enterprise-server@2.20/rest/reference/projects",
"/enterprise/2.20/v3/projects": "/enterprise-server@2.20/rest/reference/projects",
"/github-ae@latest/v3/projects": "/github-ae@latest/rest/reference/projects",
"/free-pro-team@latest/rest/reference/pulls": "/rest/reference/pulls",
"/v3/pulls": "/rest/pulls",
"/free-pro-team@latest/v3/pulls": "/rest/reference/pulls",
"/enterprise/rest/reference/pulls": "/enterprise-server@latest/rest/reference/pulls",
@@ -800,7 +780,6 @@
"/enterprise-server@2.20/v3/pulls": "/enterprise-server@2.20/rest/reference/pulls",
"/enterprise/2.20/v3/pulls": "/enterprise-server@2.20/rest/reference/pulls",
"/github-ae@latest/v3/pulls": "/github-ae@latest/rest/reference/pulls",
"/free-pro-team@latest/rest/reference/rate-limit": "/rest/reference/rate-limit",
"/v3/rate_limit": "/rest/rate-limit",
"/free-pro-team@latest/v3/rate_limit": "/rest/reference/rate-limit",
"/v3/rate-limit": "/rest/rate-limit",
@@ -815,7 +794,6 @@
"/enterprise/2.20/v3/rate-limit": "/enterprise-server@2.20/rest/reference/rate-limit",
"/github-ae@latest/v3/rate_limit": "/github-ae@latest/rest/reference/rate-limit",
"/github-ae@latest/v3/rate-limit": "/github-ae@latest/rest/reference/rate-limit",
"/free-pro-team@latest/rest/reference/reactions": "/rest/reference/reactions",
"/v3/reactions": "/rest/reactions",
"/free-pro-team@latest/v3/reactions": "/rest/reference/reactions",
"/enterprise/rest/reference/reactions": "/enterprise-server@latest/rest/reference/reactions",
@@ -824,7 +802,6 @@
"/enterprise-server@2.20/v3/reactions": "/enterprise-server@2.20/rest/reference/reactions",
"/enterprise/2.20/v3/reactions": "/enterprise-server@2.20/rest/reference/reactions",
"/github-ae@latest/v3/reactions": "/github-ae@latest/rest/reference/reactions",
"/free-pro-team@latest/rest/reference/repos": "/rest/reference/repos",
"/v3/repos": "/rest/repos",
"/free-pro-team@latest/v3/repos": "/rest/reference/repos",
"/enterprise/rest/reference/repos": "/enterprise-server@latest/rest/reference/repos",
@@ -833,10 +810,8 @@
"/enterprise-server@2.20/v3/repos": "/enterprise-server@2.20/rest/reference/repos",
"/enterprise/2.20/v3/repos": "/enterprise-server@2.20/rest/reference/repos",
"/github-ae@latest/v3/repos": "/github-ae@latest/rest/reference/repos",
"/free-pro-team@latest/rest/reference/scim": "/rest/reference/scim",
"/v3/scim": "/rest/scim",
"/free-pro-team@latest/v3/scim": "/rest/reference/scim",
"/free-pro-team@latest/rest/reference/search": "/rest/reference/search",
"/v3/search": "/rest/search",
"/free-pro-team@latest/v3/search": "/rest/reference/search",
"/enterprise/rest/reference/search": "/enterprise-server@latest/rest/reference/search",
@@ -845,8 +820,6 @@
"/enterprise-server@2.20/v3/search": "/enterprise-server@2.20/rest/reference/search",
"/enterprise/2.20/v3/search": "/enterprise-server@2.20/rest/reference/search",
"/github-ae@latest/v3/search": "/github-ae@latest/rest/reference/search",
"/free-pro-team@latest/rest/reference/secret-scanning": "/rest/reference/secret-scanning",
"/free-pro-team@latest/rest/reference/teams": "/rest/reference/teams",
"/v3/teams": "/rest/teams",
"/free-pro-team@latest/v3/teams": "/rest/reference/teams",
"/enterprise/rest/reference/teams": "/enterprise-server@latest/rest/reference/teams",
@@ -855,7 +828,6 @@
"/enterprise-server@2.20/v3/teams": "/enterprise-server@2.20/rest/reference/teams",
"/enterprise/2.20/v3/teams": "/enterprise-server@2.20/rest/reference/teams",
"/github-ae@latest/v3/teams": "/github-ae@latest/rest/reference/teams",
"/free-pro-team@latest/rest/reference/users": "/rest/reference/users",
"/v3/users": "/rest/users",
"/free-pro-team@latest/v3/users": "/rest/reference/users",
"/enterprise/rest/reference/users": "/enterprise-server@latest/rest/reference/users",

View File

@@ -1,7 +1,7 @@
import { fileURLToPath } from 'url'
import path from 'path'
import { isPlainObject } from 'lodash-es'
import { expect, jest, test } from '@jest/globals'
import { describe, expect, jest, test } from '@jest/globals'
import enterpriseServerReleases from '../../lib/enterprise-server-releases.js'
import Page from '../../lib/page.js'
@@ -563,4 +563,53 @@ describe('redirects', () => {
expect(res.headers.location).toBe(japaneseDesktopGuides)
})
})
// These tests exists because of issue #1960
describe('rest reference redirects with default product', () => {
test('rest subcategory with fpt in URL', async () => {
for (const category of [
'migrations',
'actions',
'activity',
'apps',
'billing',
'checks',
'codes-of-conduct',
'code-scanning',
'codespaces',
'emojis',
'gists',
'git',
'gitignore',
'interactions',
'issues',
'licenses',
'markdown',
'meta',
'orgs',
'projects',
'pulls',
'rate-limit',
'reactions',
'repos',
'scim',
'search',
'teams',
'users',
]) {
// Without language prefix
{
const res = await get(`/free-pro-team@latest/rest/reference/${category}`)
expect(res.statusCode).toBe(302)
expect(res.headers.location).toBe(`/en/rest/${category}`)
}
// With language prefix
{
const res = await get(`/en/free-pro-team@latest/rest/reference/${category}`)
expect(res.statusCode).toBe(301)
expect(res.headers.location).toBe(`/en/rest/${category}`)
}
}
})
})
})