File tree Expand file tree Collapse file tree 2 files changed +13
-2
lines changed Expand file tree Collapse file tree 2 files changed +13
-2
lines changed Original file line number Diff line number Diff line change @@ -79,6 +79,16 @@ describe('Cos', () => {
79
79
expect ( data ) . toMatch ( / S e r v e r l e s s \s F r a m e w o r k / gi) ;
80
80
} ) ;
81
81
82
+ test ( 'should Cos getObjectUrl success' , async ( ) => {
83
+ const res = await cos . getObjectUrl ( {
84
+ bucket,
85
+ object : 'index.html' ,
86
+ method : 'GET' ,
87
+ } ) ;
88
+
89
+ expect ( res ) . toMatch ( / h t t p / ) ;
90
+ } ) ;
91
+
82
92
test ( 'should deploy website success' , async ( ) => {
83
93
const res = await cos . website ( websiteInputs ) ;
84
94
Original file line number Diff line number Diff line change @@ -431,7 +431,7 @@ export default class Cos {
431
431
432
432
async getObjectUrl ( inputs : CosGetObjectUrlInputs = { } ) {
433
433
try {
434
- const { Url } = await this . cosClient . getObjectUrl ( {
434
+ const res = await this . cosClient . getObjectUrl ( {
435
435
Bucket : inputs . bucket ! ,
436
436
Region : this . region ,
437
437
Key : inputs . object ! ,
@@ -442,7 +442,8 @@ export default class Cos {
442
442
// default is sign url
443
443
Sign : inputs . sign === false ? false : true ,
444
444
} ) ;
445
- return Url ;
445
+ // FIXME: Fuck you Cos SDK, res is not an object;
446
+ return ( res as unknown ) as string ;
446
447
} catch ( err ) {
447
448
throw constructCosError ( `API_COS_getObjectUrl` , err ) ;
448
449
}
You can’t perform that action at this time.
0 commit comments