diff --git a/README.md b/README.md index b7f40c9cc..f50cd97ba 100644 --- a/README.md +++ b/README.md @@ -322,6 +322,8 @@ options: the details you can see [requestPay](https://help.aliyun.com/document_detail/91337.htm) - [useFetch] {Boolean}, default false, it just work in Browser, if true,it means upload object with `fetch` mode ,else `XMLHttpRequest` +- [enableProxy] {Boolean}, Enable proxy request, default is false. +- [proxy] {String | Object}, proxy agent uri or options, default is null. example: diff --git a/lib/common/utils/createRequest.js b/lib/common/utils/createRequest.js index 4ba84df4d..1326a0ece 100644 --- a/lib/common/utils/createRequest.js +++ b/lib/common/utils/createRequest.js @@ -83,6 +83,8 @@ function createRequest(params) { if (this.httpsAgent) { reqParams.httpsAgent = this.httpsAgent; } + reqParams.enableProxy = !!this.options.enableProxy; + reqParams.proxy = this.options.proxy ? this.options.proxy : null; return { url, params: reqParams diff --git a/lib/common/utils/createRequest.ts b/lib/common/utils/createRequest.ts index 85d9bfcb1..412565e82 100644 --- a/lib/common/utils/createRequest.ts +++ b/lib/common/utils/createRequest.ts @@ -102,6 +102,9 @@ export function createRequest(this: any, params) { reqParams.httpsAgent = this.httpsAgent; } + reqParams.enableProxy = !!this.options.enableProxy; + reqParams.proxy = this.options.proxy ? this.options.proxy : null; + return { url, params: reqParams