File tree Expand file tree Collapse file tree 3 files changed +15
-6
lines changed Expand file tree Collapse file tree 3 files changed +15
-6
lines changed Original file line number Diff line number Diff line change @@ -96,7 +96,6 @@ export class KeyValueStoreClient extends ResourceClient {
96
96
* If not provided, the URL will not expire.
97
97
*
98
98
* Any other options (like `limit` or `prefix`) will be included as query parameters in the URL.
99
- *
100
99
*/
101
100
async createKeysPublicUrl ( options : KeyValueClientListKeysOptions = { } , expiresInMillis ?: number ) {
102
101
ow (
@@ -111,7 +110,7 @@ export class KeyValueStoreClient extends ResourceClient {
111
110
112
111
const store = await this . get ( ) ;
113
112
114
- let createdPublicKeysUrl = new URL ( this . _url ( 'items ' ) ) ;
113
+ let createdPublicKeysUrl = new URL ( this . _url ( 'keys ' ) ) ;
115
114
116
115
if ( store ?. urlSigningSecretKey ) {
117
116
const signature = createStorageContentSignature ( {
Original file line number Diff line number Diff line change @@ -333,14 +333,18 @@ describe('Dataset methods', () => {
333
333
const datasetId = 'id-with-secret-key' ;
334
334
const res = await client . dataset ( datasetId ) . createItemsPublicUrl ( ) ;
335
335
336
- expect ( new URL ( res ) . searchParams . get ( 'signature' ) ) . toBeDefined ( ) ;
336
+ const url = new URL ( res ) ;
337
+ expect ( url . searchParams . get ( 'signature' ) ) . toBeDefined ( ) ;
338
+ expect ( url . pathname ) . toBe ( `/v2/datasets/${ datasetId } /items` ) ;
337
339
} ) ;
338
340
339
341
it ( 'should not include a signature in the URL when the caller lacks permission to access the signing secret key' , async ( ) => {
340
342
const datasetId = 'some-id' ;
341
343
const res = await client . dataset ( datasetId ) . createItemsPublicUrl ( ) ;
342
344
343
- expect ( new URL ( res ) . searchParams . get ( 'signature' ) ) . toBeNull ( ) ;
345
+ const url = new URL ( res ) ;
346
+ expect ( url . searchParams . get ( 'signature' ) ) . toBeNull ( ) ;
347
+ expect ( url . pathname ) . toBe ( `/v2/datasets/${ datasetId } /items` ) ;
344
348
} ) ;
345
349
346
350
it ( 'includes provided options (e.g., limit and prefix) as query parameters' , async ( ) => {
@@ -352,6 +356,7 @@ describe('Dataset methods', () => {
352
356
expect ( itemsPublicUrl . searchParams . get ( 'limit' ) ) . toBe ( '10' ) ;
353
357
expect ( itemsPublicUrl . searchParams . get ( 'offset' ) ) . toBe ( '5' ) ;
354
358
expect ( itemsPublicUrl . searchParams . get ( 'signature' ) ) . toBeDefined ( ) ;
359
+ expect ( itemsPublicUrl . pathname ) . toBe ( `/v2/datasets/${ datasetId } /items` ) ;
355
360
} ) ;
356
361
} ) ;
357
362
} ) ;
Original file line number Diff line number Diff line change @@ -559,14 +559,18 @@ describe('Key-Value Store methods', () => {
559
559
const storeId = 'id-with-secret-key' ;
560
560
const res = await client . keyValueStore ( storeId ) . createKeysPublicUrl ( ) ;
561
561
562
- expect ( new URL ( res ) . searchParams . get ( 'signature' ) ) . toBeDefined ( ) ;
562
+ const url = new URL ( res ) ;
563
+ expect ( url . searchParams . get ( 'signature' ) ) . toBeDefined ( ) ;
564
+ expect ( url . pathname ) . toBe ( `/v2/key-value-stores/${ storeId } /keys` ) ;
563
565
} ) ;
564
566
565
567
it ( 'should not include a signature in the URL when the caller lacks permission to access the signing secret key' , async ( ) => {
566
568
const storeId = 'some-id' ;
567
569
const res = await client . keyValueStore ( storeId ) . createKeysPublicUrl ( ) ;
568
570
569
- expect ( new URL ( res ) . searchParams . get ( 'signature' ) ) . toBeNull ( ) ;
571
+ const url = new URL ( res ) ;
572
+ expect ( url . searchParams . get ( 'signature' ) ) . toBeNull ( ) ;
573
+ expect ( url . pathname ) . toBe ( `/v2/key-value-stores/${ storeId } /keys` ) ;
570
574
} ) ;
571
575
572
576
it ( 'includes provided options (e.g., limit and prefix) as query parameters' , async ( ) => {
@@ -577,6 +581,7 @@ describe('Key-Value Store methods', () => {
577
581
expect ( keysPublicUrl . searchParams . get ( 'limit' ) ) . toBe ( '10' ) ;
578
582
expect ( keysPublicUrl . searchParams . get ( 'prefix' ) ) . toBe ( 'prefix' ) ;
579
583
expect ( keysPublicUrl . searchParams . get ( 'signature' ) ) . toBeDefined ( ) ;
584
+ expect ( keysPublicUrl . pathname ) . toBe ( `/v2/key-value-stores/${ storeId } /keys` ) ;
580
585
} ) ;
581
586
} ) ;
582
587
} ) ;
You can’t perform that action at this time.
0 commit comments