Skip to content

Commit

Permalink
chore(nextjs): Remove unused utilities (#4230)
Browse files Browse the repository at this point in the history
  • Loading branch information
panteliselef authored Sep 26, 2024
1 parent 2e35ac5 commit 0cde71a
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 17 deletions.
2 changes: 2 additions & 0 deletions .changeset/odd-days-obey.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
---
---
17 changes: 0 additions & 17 deletions packages/nextjs/src/server/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,6 @@ import { authSignatureInvalid, encryptionKeyInvalid, missingDomainAndProxy, miss
import { errorThrower } from './errorThrower';
import type { RequestLike } from './types';

export function setCustomAttributeOnRequest(req: RequestLike, key: string, value: string): void {
Object.assign(req, { [key]: value });
}

export function getCustomAttributeFromRequest(req: RequestLike, key: string): string | null | undefined {
// @ts-expect-error - TS doesn't like indexing into RequestLike
return key in req ? req[key] : undefined;
Expand All @@ -32,13 +28,6 @@ export function getAuthKeyFromRequest(
return getCustomAttributeFromRequest(req, constants.Attributes[key]) || getHeader(req, constants.Headers[key]);
}

// TODO: Rename Auth status and align the naming across media
export function getAuthStatusFromRequest(req: RequestLike): string | null | undefined {
return (
getCustomAttributeFromRequest(req, constants.Attributes.AuthStatus) || getHeader(req, constants.Headers.AuthStatus)
);
}

export function getHeader(req: RequestLike, name: string): string | null | undefined {
if (isNextRequest(req)) {
return req.headers.get(name);
Expand Down Expand Up @@ -173,12 +162,6 @@ export const apiEndpointUnauthorizedNextResponse = () => {
return NextResponse.json(null, { status: 401, statusText: 'Unauthorized' });
};

export const isCrossOrigin = (from: string | URL, to: string | URL) => {
const fromUrl = new URL(from);
const toUrl = new URL(to);
return fromUrl.origin !== toUrl.origin;
};

export const handleMultiDomainAndProxy = (clerkRequest: ClerkRequest, opts: AuthenticateRequestOptions) => {
const relativeOrAbsoluteProxyUrl = handleValueOrFn(opts?.proxyUrl, clerkRequest.clerkUrl, PROXY_URL);

Expand Down

0 comments on commit 0cde71a

Please sign in to comment.