Skip to content

Commit d69c244

Browse files
committed
fix(cdn): update domain api error
1 parent 01b3285 commit d69c244

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

src/modules/cdn/index.js

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ class Cdn {
7373
OnlyRefresh = false,
7474
Domain,
7575
Origin,
76-
ServiceType = 'web',
76+
ServiceType,
7777
Area = 'mainland',
7878
Https,
7979
Cache,
@@ -120,7 +120,6 @@ class Cdn {
120120
const cdnInputs = flushEmptyValue({
121121
Domain,
122122
Origin: formatOrigin(Origin),
123-
ServiceType,
124123
Area,
125124
Cache,
126125
IpFilter,
@@ -182,13 +181,18 @@ class Cdn {
182181
// update
183182
console.log(`The CDN domain ${Domain} has existed.`);
184183
console.log('Updating...');
185-
// when update, can not set ServiceType parameter
184+
// TODO: when update, VIP user can not set ServiceType parameter, need CDN api optimize
185+
if (ServiceType && ServiceType !== cdnInfo.ServiceType) {
186+
cdnInputs.ServiceType = ServiceType;
187+
}
186188
await UpdateDomainConfig(this.capi, cdnInputs);
187189
outputs.resourceId = cdnInfo.ResourceId;
188190
} else {
189191
// create
190192
console.log(`Adding CDN domain ${Domain}...`);
191193
try {
194+
// if not config ServiceType, default to web
195+
cdnInputs.ServiceType = ServiceType || 'web';
192196
await AddCdnDomain(this.capi, cdnInputs);
193197
} catch (e) {
194198
if (e.code === 9111) {

0 commit comments

Comments
 (0)