Skip to content

Commit

Permalink
feat(yi_jing_tong): 增加代理设置
Browse files Browse the repository at this point in the history
  • Loading branch information
wangjue666 committed Aug 5, 2024
1 parent bf4594f commit 62462be
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 7 deletions.
2 changes: 1 addition & 1 deletion packages/yi_jing_tong/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@cn-international-express-sdk/yi_jing_tong",
"version": "0.1.1",
"version": "0.1.2",
"types": "./dist/types/index.d.ts",
"main": "./dist/lib/index.js",
"module": "./dist/es/index.js",
Expand Down
17 changes: 11 additions & 6 deletions packages/yi_jing_tong/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
import {
Recordable,
postJSONRequest,
} from '@cn-international-express-sdk/utils';
import { Recordable, myRequest } from '@cn-international-express-sdk/utils';
import { YiJingTongConfig } from './state';

export * from './state';

export class YiJingTong {
private config: YiJingTongConfig;

constructor(config: YiJingTongConfig) {
private proxy: string;

constructor(config: YiJingTongConfig, proxy: string) {
this.config = config;
this.proxy = proxy;
}

async genRequest<T>(action: string, sendData: Recordable = {}): Promise<T> {
Expand All @@ -23,7 +23,12 @@ export class YiJingTong {
token: this.config.app_token,
...sendData,
};
const res = await postJSONRequest<T>(url, row);
const res = await myRequest<T>({
url,
json: row,
method: 'POST',
proxy: this.proxy,
});
return res;
}
}

0 comments on commit 62462be

Please sign in to comment.