Files
shields/services/azure-devops/vso-redirect.tester.js
Paul Melnikow 1486fd2fca Redirect from alias to canonical URL [azuredevops vso] (#2939)
As described in #2340, this provides a way to replace an old alias with a redirect. This makes it easier to migrate our URLs over time without making our matching patterns more complicated.

The 301 redirect is sent back to the requester. If a user pastes the aliased URL into the address bar, it'll be replaced in the browser with the new URL, which gently encourages them to migrate.

Close #2340
2019-02-08 01:07:50 -05:00

39 lines
972 B
JavaScript

'use strict'
const { ServiceTester } = require('../tester')
const t = (module.exports = new ServiceTester({
id: 'vso',
title: 'VSO',
}))
t.create('Build: default branch')
.get('/build/totodem/8cf3ec0e-d0c2-4fcd-8206-ad204f254a96/2.svg', {
followRedirect: false,
})
.expectStatus(301)
.expectHeader(
'Location',
'/azure-devops/build/totodem/8cf3ec0e-d0c2-4fcd-8206-ad204f254a96/2.svg'
)
t.create('Build: named branch')
.get('/build/totodem/8cf3ec0e-d0c2-4fcd-8206-ad204f254a96/2/master.svg', {
followRedirect: false,
})
.expectStatus(301)
.expectHeader(
'Location',
'/azure-devops/build/totodem/8cf3ec0e-d0c2-4fcd-8206-ad204f254a96/2/master.svg'
)
t.create('Release status')
.get('/release/totodem/8cf3ec0e-d0c2-4fcd-8206-ad204f254a96/1/1.svg', {
followRedirect: false,
})
.expectStatus(301)
.expectHeader(
'Location',
'/azure-devops/release/totodem/8cf3ec0e-d0c2-4fcd-8206-ad204f254a96/1/1.svg'
)