From 1658769a30eae5e642c7c2a54aecf88aec4fd274 Mon Sep 17 00:00:00 2001 From: zyachel Date: Sun, 13 Nov 2022 17:39:29 +0530 Subject: [PATCH] feat: force a certain language when getting data when fetching data, sometimes it's returned in a language depending on server IP address. this commit fixes that behaviour https://github.com/zyachel/libremdb/issues/20 --- .env.local.example | 2 +- src/utils/axiosInstance.ts | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/.env.local.example b/.env.local.example index 2429dc8..551eced 100644 --- a/.env.local.example +++ b/.env.local.example @@ -10,7 +10,7 @@ NEXT_TELEMETRY_DISABLED=1 ## default accept header is 'application/json, text/plain, */*' # AXIOS_ACCEPT= ## for forcing a certain language for data we get from imdb -# AXIOS_LANGUAGE=en-US +# AXIOS_LANGUAGE='en-US,en;q=0.5' ### REDIS ## if you want to use redis to speed up the media proxy, set this to true diff --git a/src/utils/axiosInstance.ts b/src/utils/axiosInstance.ts index 702ba2c..4ce7bfd 100644 --- a/src/utils/axiosInstance.ts +++ b/src/utils/axiosInstance.ts @@ -8,6 +8,9 @@ const axiosInstance = axios.create({ 'User-Agent': process.env.AXIOS_USERAGENT, }), ...(process.env.AXIOS_ACCEPT && { Accept: process.env.AXIOS_ACCEPT }), + ...(process.env.AXIOS_LANGUAGE && { + 'Accept-Language': process.env.AXIOS_LANGUAGE, + }), }, });