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:
parent
5fb1857538
commit
b6279f4128
|
@ -7,7 +7,9 @@ type CountryCodeOptions = {
|
||||||
export const countryCodeHandler = async ({ ctx }: CountryCodeOptions) => {
|
export const countryCodeHandler = async ({ ctx }: CountryCodeOptions) => {
|
||||||
const { req } = ctx;
|
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 };
|
return { countryCode: Array.isArray(countryCode) ? countryCode[0] : countryCode };
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user