mirror of
https://github.com/kevin-DL/sapper.git
synced 2026-01-19 22:05:20 +00:00
@@ -177,7 +177,7 @@ export function get_page_handler(
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
if (redirect) {
|
if (redirect) {
|
||||||
const location = URL.resolve(req.baseUrl || '/', redirect.location);
|
const location = URL.resolve((req.baseUrl || '') + '/', redirect.location);
|
||||||
|
|
||||||
res.statusCode = redirect.statusCode;
|
res.statusCode = redirect.statusCode;
|
||||||
res.setHeader('Location', location);
|
res.setHeader('Location', location);
|
||||||
|
|||||||
@@ -13,6 +13,7 @@ describe('with-basepath', function() {
|
|||||||
let page: puppeteer.Page;
|
let page: puppeteer.Page;
|
||||||
let base: string;
|
let base: string;
|
||||||
|
|
||||||
|
// helpers
|
||||||
let start: () => Promise<void>;
|
let start: () => Promise<void>;
|
||||||
let prefetchRoutes: () => Promise<void>;
|
let prefetchRoutes: () => Promise<void>;
|
||||||
let title: () => Promise<string>;
|
let title: () => Promise<string>;
|
||||||
@@ -63,14 +64,13 @@ describe('with-basepath', function() {
|
|||||||
'custom-basepath/global.css',
|
'custom-basepath/global.css',
|
||||||
'custom-basepath/index.html',
|
'custom-basepath/index.html',
|
||||||
'custom-basepath/redirect-from/index.html',
|
'custom-basepath/redirect-from/index.html',
|
||||||
'custom-basepath/redirect-to',
|
'custom-basepath/redirect-to/index.html',
|
||||||
'custom-basepath/service-worker-index.html',
|
'custom-basepath/service-worker-index.html',
|
||||||
'custom-basepath/service-worker.js'
|
'custom-basepath/service-worker.js'
|
||||||
]);
|
]);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('redirects on server', async () => {
|
it('redirects on server', async () => {
|
||||||
console.log('base', base)
|
|
||||||
await page.goto(`${base}/custom-basepath/redirect-from`);
|
await page.goto(`${base}/custom-basepath/redirect-from`);
|
||||||
|
|
||||||
assert.equal(
|
assert.equal(
|
||||||
|
|||||||
Reference in New Issue
Block a user