I´m currently forced to comment or uncomment a single line in my request object, depending if my application currently run my local system or the productive server.
I already tried to solve this problem with a bool variable, but it does not work. Here is my Code
const dev = true;
const devProxy = dev
? {agent: new HttpsProxyAgent("http://proxy:80")}
: {};
myFunc: async access_token => {
const response = await fetch(
URL,
{
// agent: new HttpsProxyAgent("http://proxy:89´0"),
devProxy,
method: "GET",
headers: {
Accept: "application/json",
"Content-Type": "application/json",
Authorization: `Bearer ${access_token.access_token}`
}
}
);
if (response.ok) {
return response.json();
}
throw new Error(
"bla" +
response.status +
" StatusText: " +
response.statusText
);
},
The error says that the proxy was not used.
How can I correctly do it?