Skip to content

Commit 5259d24

Browse files
committedDec 12, 2022
fix(next): correctly bundle next-auth/middleware
fixes #6025
1 parent d1d93fd commit 5259d24

File tree

2 files changed

+11
-15
lines changed

2 files changed

+11
-15
lines changed
 

‎packages/next-auth/src/next/middleware.ts

+11-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,17 @@ import { NextResponse, NextRequest } from "next/server"
66

77
import { getToken } from "../jwt"
88
import parseUrl from "../utils/parse-url"
9-
import { detectHost } from "../utils/web"
9+
10+
// // TODO: Remove
11+
/** Extract the host from the environment */
12+
export function detectHost(
13+
trusted: boolean,
14+
forwardedValue: string | null,
15+
defaultValue: string | false
16+
): string | undefined {
17+
if (trusted && forwardedValue) return forwardedValue
18+
return defaultValue || undefined
19+
}
1020

1121
type AuthorizedCallback = (params: {
1222
token: JWT | null

‎packages/next-auth/src/utils/web.ts

-14
Original file line numberDiff line numberDiff line change
@@ -119,17 +119,3 @@ export function toResponse(res: ResponseInternal): Response {
119119

120120
return response
121121
}
122-
123-
// TODO: Remove
124-
/** Extract the host from the environment */
125-
export function detectHost(
126-
trusted: boolean,
127-
forwardedValue: string | string[] | undefined | null,
128-
defaultValue: string | false
129-
): string | undefined {
130-
if (trusted && forwardedValue) {
131-
return Array.isArray(forwardedValue) ? forwardedValue[0] : forwardedValue
132-
}
133-
134-
return defaultValue || undefined
135-
}

0 commit comments

Comments
 (0)
Please sign in to comment.