Merge branch 'main' into feature/1.5.1

This commit is contained in:
Matti Nannt
2024-02-04 12:44:48 +01:00
committed by GitHub
2 changed files with 10 additions and 2 deletions

View File

@@ -23,7 +23,11 @@ export async function POST(request: Request): Promise<NextResponse> {
responseInput.personId = null;
}
const agent = UAParser(request.headers.get("user-agent"));
const country = headers().get("CF-IPCountry") || headers().get("X-Vercel-IP-Country") || undefined;
const country =
headers().get("CF-IPCountry") ||
headers().get("X-Vercel-IP-Country") ||
headers().get("CloudFront-Viewer-Country") ||
undefined;
const inputValidation = ZResponseLegacyInput.safeParse(responseInput);
if (!inputValidation.success) {

View File

@@ -46,7 +46,11 @@ export async function POST(request: Request, context: Context): Promise<NextResp
}
const agent = UAParser(request.headers.get("user-agent"));
const country = headers().get("CF-IPCountry") || headers().get("X-Vercel-IP-Country") || undefined;
const country =
headers().get("CF-IPCountry") ||
headers().get("X-Vercel-IP-Country") ||
headers().get("CloudFront-Viewer-Country") ||
undefined;
const inputValidation = ZResponseInput.safeParse({ ...responseInput, environmentId });
if (!inputValidation.success) {