Skip to content

Commit

Permalink
feat: support proxy (#858)
Browse files Browse the repository at this point in the history
  • Loading branch information
weiyie committed Sep 10, 2020
1 parent 2624cc3 commit ca287ba
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 0 deletions.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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:

Expand Down
2 changes: 2 additions & 0 deletions lib/common/utils/createRequest.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 3 additions & 0 deletions lib/common/utils/createRequest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit ca287ba

Please sign in to comment.