@@ -29,7 +29,7 @@ import {
29
29
SignerExceptionMessages ,
30
30
} from '../src/signer' ;
31
31
import { encodeURI , formatAsUTCISO , qsStringify } from '../src/util' ;
32
- import { Storage , ExceptionMessages } from '../src/storage' ;
32
+ import { ExceptionMessages } from '../src/storage' ;
33
33
import { OutgoingHttpHeaders } from 'http' ;
34
34
35
35
interface SignedUrlArgs {
@@ -574,38 +574,16 @@ describe('signer', () => {
574
574
} ) ;
575
575
576
576
it ( 'should not throw with expiration of exactly 7 days' , async ( ) => {
577
- const file = new Storage ( {
578
- projectId : 'xxxx' ,
579
- credentials : {
580
- type : 'service_account' ,
581
- private_key : crypto . generateKeyPairSync ( 'rsa' , {
582
- modulusLength : 512 ,
583
- publicKeyEncoding : {
584
- type : 'spki' ,
585
- format : 'pem' ,
586
- } ,
587
- privateKeyEncoding : {
588
- type : 'pkcs8' ,
589
- format : 'pem' ,
590
- } ,
591
- } ) . privateKey ,
592
- client_email : 'xxxx' ,
593
- client_id : 'xxx' ,
594
- } ,
595
- } )
596
- . bucket ( BUCKET_NAME )
597
- . file ( FILE_NAME ) ;
598
577
const ACCESSIBLE_AT = NOW . valueOf ( ) ;
599
578
const SEVEN_DAYS_IN_SECONDS = 7 * 24 * 60 * 60 ;
600
579
const SEVEN_DAYS_IN_MS = SEVEN_DAYS_IN_SECONDS * 1000 ;
601
580
await assert . doesNotReject (
602
581
async ( ) => {
603
- await file . getSignedUrl ( {
604
- version : 'v4' ,
605
- action : 'read' ,
606
- accessibleAt : ACCESSIBLE_AT ,
582
+ await signer . getSignedUrl ( {
583
+ method : 'GET' ,
607
584
expires : ACCESSIBLE_AT + SEVEN_DAYS_IN_MS ,
608
- virtualHostedStyle : true ,
585
+ accessibleAt : ACCESSIBLE_AT ,
586
+ version : 'v4' ,
609
587
} ) ;
610
588
} ,
611
589
err => {
0 commit comments