Sử dụng Proxy

Cấu hình proxy cho zca-js

Đối với Bun

const zalo = new Zalo({
    agent: "http(s)://user:pass@host:port",
});

Đối với NodeJS

Vì native fetch của NodeJS không hỗ trợ proxy nên phải thay thế nó bằng node-fetch

import { Zalo } from "zca-js";
import { HttpProxyAgent } from "http-proxy-agent";
import nodefetch from "node-fetch";

const zalo = new Zalo({
    agent: new HttpProxyAgent("http(s)://user:pass@host:port"),
    // @ts-ignore
    polyfill: nodefetch
});

Last updated