Skip to content

Commit

Permalink
use new endpoint convention
Browse files Browse the repository at this point in the history
  • Loading branch information
rockuw committed Oct 12, 2017
1 parent bc7b4ac commit 7c91963
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 8 deletions.
4 changes: 2 additions & 2 deletions es5/client.js
Expand Up @@ -101,8 +101,8 @@ var Client = function () {

var internal = config.internal ? '-internal' : '';

this.endpoint = `${protocol}://${accountid}.fc.${region}${internal}.aliyuncs.com`;
this.host = `${accountid}.fc.${region}${internal}.aliyuncs.com`;
this.endpoint = `${protocol}://${accountid}.${region}${internal}.fc.aliyuncs.com`;
this.host = `${accountid}.${region}${internal}.fc.aliyuncs.com`;
this.version = '2016-08-15';
this.timeout = Number.isFinite(config.timeout) ? config.timeout : 10000; // default is 10s
}
Expand Down
4 changes: 2 additions & 2 deletions lib/client.js
Expand Up @@ -89,8 +89,8 @@ class Client {

const internal = config.internal ? '-internal': '';

this.endpoint = `${protocol}://${accountid}.fc.${region}${internal}.aliyuncs.com`;
this.host = `${accountid}.fc.${region}${internal}.aliyuncs.com`;
this.endpoint = `${protocol}://${accountid}.${region}${internal}.fc.aliyuncs.com`;
this.host = `${accountid}.${region}${internal}.fc.aliyuncs.com`;
this.version = '2016-08-15';
this.timeout = Number.isFinite(config.timeout) ? config.timeout : 10000; // default is 10s
}
Expand Down
8 changes: 4 additions & 4 deletions test/client.test.js
Expand Up @@ -55,23 +55,23 @@ describe('client test', function () {
accessKeySecret: 'accessKeySecret',
region: 'cn-shanghai'
});
expect(client.endpoint).to.be('http://accountid.fc.cn-shanghai.aliyuncs.com');
expect(client.endpoint).to.be('http://accountid.cn-shanghai.fc.aliyuncs.com');

client = new FunctionComputeClient('accountid', {
accessKeyID: 'STS.accessKeyID',
accessKeySecret: 'accessKeySecret',
region: 'cn-shanghai',
securityToken: 'securityToken',
});
expect(client.endpoint).to.be('http://accountid.fc.cn-shanghai.aliyuncs.com');
expect(client.endpoint).to.be('http://accountid.cn-shanghai.fc.aliyuncs.com');

client = new FunctionComputeClient('accountid', {
accessKeyID: 'accessKeyID',
accessKeySecret: 'accessKeySecret',
region: 'cn-shanghai',
secure: true
});
expect(client.endpoint).to.be('https://accountid.fc.cn-shanghai.aliyuncs.com');
expect(client.endpoint).to.be('https://accountid.cn-shanghai.fc.aliyuncs.com');

client = new FunctionComputeClient('accountid', {
accessKeyID: 'accessKeyID',
Expand All @@ -80,7 +80,7 @@ describe('client test', function () {
secure: true,
internal: true
});
expect(client.endpoint).to.be('https://accountid.fc.cn-shanghai-internal.aliyuncs.com');
expect(client.endpoint).to.be('https://accountid.cn-shanghai-internal.fc.aliyuncs.com');

client = new FunctionComputeClient('accountid', {
accessKeyID: 'accessKeyID',
Expand Down

0 comments on commit 7c91963

Please sign in to comment.