Deno 网络请求有Proxy吗

如题, Deno 的官方库fetch看上去没有proxy 有相关的支持吗

目前deno里的fetch和浏览器里API完全一致,代理只能用外部(系统)代理,或者自己做反向代理

运行 deno help 就可以看到了:

ENVIRONMENT VARIABLES:
    DENO_DIR             Set the cache directory
    DENO_INSTALL_ROOT    Set deno install's output directory
                         (defaults to $HOME/.deno/bin)
    DENO_CERT            Load certificate authority from PEM encoded file
    NO_COLOR             Set to disable color
  * HTTP_PROXY           Proxy address for HTTP requests
                         (module downloads, fetch)
  * HTTPS_PROXY          Proxy address for HTTPS requests
                         (module downloads, fetch)
    NO_PROXY             Comma-separated list of hosts which do not use a proxy
                         (module downloads, fetch)

只需要设置 HTTP_PROXYHTTPS_PROXY 两个环境变量就可以了。比如,在 Mac 系统上可以运行:

export http_proxy=http://127.0.0.1:1087;
export https_proxy=http://127.0.0.1:1087;
1赞