mirror of
https://github.com/GitbookIO/gitbook.git
synced 2026-09-19 09:06:03 +00:00
Update test + implementation
This commit is contained in:
@@ -259,11 +259,7 @@ async function serveSiteRoutes(requestURL: URL, request: NextRequest) {
|
||||
console.log(`rewriting ${request.nextUrl.toString()} to ${route}`);
|
||||
|
||||
const rewrittenURL = new URL(`/${route}`, request.nextUrl.toString());
|
||||
|
||||
// Ensure all searchParams are brought over to the rewritten URL
|
||||
request.nextUrl.searchParams.forEach((value, key) => {
|
||||
rewrittenURL.searchParams.set(key, value);
|
||||
});
|
||||
rewrittenURL.search = request.nextUrl.search; // Preserve the original search params
|
||||
|
||||
const response = NextResponse.rewrite(rewrittenURL, {
|
||||
request: {
|
||||
|
||||
@@ -82,11 +82,11 @@ const testCases: TestsCase[] = [
|
||||
},
|
||||
{
|
||||
name: 'PDF (all pages)',
|
||||
url: '~gitbook/pdf?limit=100',
|
||||
url: '~gitbook/pdf?limit=10',
|
||||
},
|
||||
{
|
||||
name: 'PDF (only current page)',
|
||||
url: '~gitbook/pdf?page=Bw7LjWwgTjV8nIV4s7rs&only=yes&limit=100',
|
||||
url: '~gitbook/pdf?page=Bw7LjWwgTjV8nIV4s7rs&only=yes&limit=2',
|
||||
},
|
||||
{
|
||||
name: 'Not found',
|
||||
@@ -316,11 +316,11 @@ const testCases: TestsCase[] = [
|
||||
},
|
||||
{
|
||||
name: 'PDF (all pages)',
|
||||
url: '~gitbook/pdf?limit=100',
|
||||
url: '~gitbook/pdf?limit=10',
|
||||
},
|
||||
{
|
||||
name: 'PDF (only current page)',
|
||||
url: '~gitbook/pdf?page=DfnNkU49mvLe2ythHAyx&only=yes&limit=100',
|
||||
url: '~gitbook/pdf?page=DfnNkU49mvLe2ythHAyx&only=yes&limit=2', // limit 2 pages to catch any bugs with multiple pages
|
||||
},
|
||||
{
|
||||
name: 'Not found',
|
||||
|
||||
Reference in New Issue
Block a user