Reputation: 124
I need to use proxy e.g. SocksProxyAgent
in axios, and at the same time cookiejar:
import { Cookie, CookieJar } from "tough-cookie";
import { wrapper } from "axios-cookiejar-support";
const axiosConfig: AxiosRequestConfig<any> = {
headers: {},
maxRedirects: 0,
jar: this.cookieJar, // Use tough-cookie jar
withCredentials: true, // Required for axios to use the cookie jar
};
this.request = wrapper(axios.create(axiosConfig));
const proxyAgent = new SocksProxyAgent(proxy);
this.request.defaults.httpAgent = proxyAgent;//error here
this.request.defaults.httpsAgent = proxyAgent;
But I get this error:
axios-cookiejar-support does not support for use with other http(s).Agent.
Upvotes: 2
Views: 250