Skip to content

Commit 2ebd7ac

Browse files
fix: change copyoptions type (#2439)
* fix: change copyoptions type * fix: added test * chore: address pr comments
1 parent 1d434a9 commit 2ebd7ac

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

src/file.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -361,7 +361,9 @@ export interface CopyOptions {
361361
contentType?: string;
362362
contentDisposition?: string;
363363
destinationKmsKeyName?: string;
364-
metadata?: FileMetadata;
364+
metadata?: {
365+
[key: string]: string | boolean | number | null;
366+
};
365367
predefinedAcl?: string;
366368
token?: string;
367369
userProject?: string;

test/file.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -545,12 +545,17 @@ describe('File', () => {
545545

546546
it('should accept an options object', done => {
547547
const newFile = new File(BUCKET, 'name');
548+
const METADATA = {
549+
metadataKey: 'metadataValue',
550+
};
548551
const options = {
549552
option: true,
553+
metadata: METADATA,
550554
};
551555

552556
file.request = (reqOpts: DecorateRequestOptions) => {
553557
assert.deepStrictEqual(reqOpts.json, options);
558+
assert.strictEqual(reqOpts.json.metadata, METADATA);
554559
done();
555560
};
556561

0 commit comments

Comments
 (0)