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 TakkarandAlex van Andel authored and GitHub committed 2023-12-19 08:01:08 +00:00
1 parent 5fb1857538
commit b6279f4128
1 file changed
+3 -1
@@ -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 };
};