Skip to content

Commit b20bcaa

Browse files
committed
Use join path, remove unused method
1 parent 3e2bbf2 commit b20bcaa

File tree

2 files changed

+1
-11
lines changed

2 files changed

+1
-11
lines changed

packages/gitbook/src/lib/pages.ts

-10
Original file line numberDiff line numberDiff line change
@@ -185,13 +185,3 @@ function flattenPages(
185185

186186
return result;
187187
}
188-
189-
/**
190-
* Returns a page not found if the request is not from the middleware.
191-
* Some pages can be
192-
*/
193-
export async function checkIsFromMiddleware() {
194-
const headerList = await headers();
195-
// To check if the request is from the middleware, we check if the x-gitbook-token is set in the headers.
196-
return Boolean(headerList.get('x-gitbook-token'));
197-
}

packages/gitbook/src/middleware.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -277,7 +277,7 @@ export async function middleware(request: NextRequest) {
277277
headers.set('x-gitbook-visitor-token', resolved.visitorToken);
278278
}
279279

280-
const target = new URL('/middleware' + rewritePathname, request.nextUrl.toString());
280+
const target = new URL(joinPath('/middleware', rewritePathname), request.nextUrl.toString());
281281
target.search = url.search;
282282

283283
const response = writeCookies(

0 commit comments

Comments
 (0)