Skip to content

Commit

Permalink
feat: allow setting contentEncoding during compose
Browse files Browse the repository at this point in the history
  • Loading branch information
zuozp8 authored and eforks committed Mar 26, 2024
1 parent 36d2721 commit 2f6c03c
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
1 change: 1 addition & 0 deletions src/bucket.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1658,6 +1658,7 @@ class Bucket extends ServiceObject<Bucket, BucketMetadata> {
json: {
destination: {
contentType: destinationFile.metadata.contentType,
contentEncoding: destinationFile.metadata.contentEncoding,
},
sourceObjects: (sources as File[]).map(source => {
const sourceObject = {
Expand Down
6 changes: 3 additions & 3 deletions test/bucket.ts
Original file line number Diff line number Diff line change
Expand Up @@ -745,13 +745,13 @@ describe('Bucket', () => {
});

it('should make correct API request', done => {
const sources = [bucket.file('1.txt'), bucket.file('2.txt')];
const destination = bucket.file('destination.txt');
const sources = [bucket.file('1.foo'), bucket.file('2.foo')];
const destination = bucket.file('destination.foo');

destination.request = (reqOpts: DecorateRequestOptions) => {
assert.strictEqual(reqOpts.uri, '/compose');
assert.deepStrictEqual(reqOpts.json, {
destination: {contentType: mime.contentType(destination.name)},
destination: {contentType: undefined, contentEncoding: undefined},
sourceObjects: [{name: sources[0].name}, {name: sources[1].name}],
});

Expand Down

0 comments on commit 2f6c03c

Please sign in to comment.