fix: country code [Testing] (#12807)

* fix: country code

* chore

* chore: only test cloudflare

---------

Co-authored-by: Alex van Andel <me@alexvanandel.com>
This commit is contained in:
Udit Takkar 2023-12-19 13:31:08 +05:30 committed by GitHub
parent 5fb1857538
commit b6279f4128
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -7,7 +7,9 @@ type CountryCodeOptions = {
export const countryCodeHandler = async ({ ctx }: CountryCodeOptions) => {
const { req } = ctx;
const countryCode: string | string[] = req?.headers?.["x-vercel-ip-country"] ?? "";
// const countryCode: string | string[] =
// req?.headers?.["cf-ipcountry"] ?? req?.headers?.["x-vercel-ip-country"] ?? "";
const countryCode: string | string[] = req?.headers?.["cf-ipcountry"] ?? "";
return { countryCode: Array.isArray(countryCode) ? countryCode[0] : countryCode };
};