Skip to content

Commit 06089af

Browse files
committed
feat: support passing signingEndpoint to getSignedUrl in file operations
1 parent ca43580 commit 06089af

2 files changed

Lines changed: 20 additions & 0 deletions

File tree

handwritten/storage/src/file.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3236,6 +3236,7 @@ class File extends ServiceObject<File, FileMetadata> {
32363236
contentMd5: cfg.contentMd5,
32373237
contentType: cfg.contentType,
32383238
host: cfg.host,
3239+
signingEndpoint: cfg.signingEndpoint,
32393240
};
32403241

32413242
if (cfg.cname) {

handwritten/storage/test/file.ts

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3794,11 +3794,30 @@ describe('File', () => {
37943794
contentType: config.contentType,
37953795
cname: CNAME,
37963796
virtualHostedStyle: true,
3797+
signingEndpoint: undefined,
37973798
});
37983799
done();
37993800
});
38003801
});
38013802

3803+
it('should pass signingEndpoint to URLSigner', done => {
3804+
const signingEndpoint = 'https://my-endpoint.com';
3805+
const config = {
3806+
signingEndpoint,
3807+
...SIGNED_URL_CONFIG,
3808+
};
3809+
3810+
file.getSignedUrl(config, (err: Error | null) => {
3811+
assert.ifError(err);
3812+
const getSignedUrlArgs = signerGetSignedUrlStub.getCall(0).args;
3813+
assert.strictEqual(
3814+
getSignedUrlArgs[0]['signingEndpoint'],
3815+
signingEndpoint
3816+
);
3817+
done();
3818+
});
3819+
});
3820+
38023821
it('should add "x-goog-resumable: start" header if action is resumable', done => {
38033822
SIGNED_URL_CONFIG.action = 'resumable';
38043823
SIGNED_URL_CONFIG.extensionHeaders = {

0 commit comments

Comments
 (0)