chore: added a fallback for country code (#13171)

Co-authored-by: Peer Richelsen <[email protected]>
This commit is contained in:
Udit TakkarandPeer Richelsen authored and GitHub committed 2024-01-15 09:51:16 +00:00
1 parent 0a921c2929
commit b1bf94aa58
1 file changed
+2 -3
@@ -7,9 +7,8 @@ type CountryCodeOptions = {
export const countryCodeHandler = async ({ ctx }: CountryCodeOptions) => {
const { req } = ctx;
// const countryCode: string | string[] =
// req?.headers?.["​cf-ipcountry"] ?? req?.headers?.["x-vercel-ip-country"] ?? "";
const countryCode: string | string[] = req?.headers?.["​cf-ipcountry"] ?? "";
const countryCode: string | string[] =
req?.headers?.["​cf-ipcountry"] ?? req?.headers?.["x-vercel-ip-country"] ?? "";
return { countryCode: Array.isArray(countryCode) ? countryCode[0] : countryCode };
};