diff --git a/handwritten/storage/src/file.ts b/handwritten/storage/src/file.ts index 27765d935a99..d5aa40bf96e1 100644 --- a/handwritten/storage/src/file.ts +++ b/handwritten/storage/src/file.ts @@ -3236,6 +3236,7 @@ class File extends ServiceObject { contentMd5: cfg.contentMd5, contentType: cfg.contentType, host: cfg.host, + signingEndpoint: cfg.signingEndpoint, }; if (cfg.cname) { diff --git a/handwritten/storage/src/signer.ts b/handwritten/storage/src/signer.ts index a657cef6133d..ba5c17c04b75 100644 --- a/handwritten/storage/src/signer.ts +++ b/handwritten/storage/src/signer.ts @@ -25,7 +25,7 @@ type GoogleAuthLike = Pick; * @deprecated Use {@link GoogleAuth} instead */ export interface AuthClient { - sign(blobToSign: string): Promise; + sign(blobToSign: string, signingEndpoint?: string): Promise; getCredentials(): Promise<{ client_email?: string; }>; diff --git a/handwritten/storage/test/file.ts b/handwritten/storage/test/file.ts index 26823995b907..d9f9185a16e8 100644 --- a/handwritten/storage/test/file.ts +++ b/handwritten/storage/test/file.ts @@ -3794,11 +3794,30 @@ describe('File', () => { contentType: config.contentType, cname: CNAME, virtualHostedStyle: true, + signingEndpoint: undefined, }); done(); }); }); + it('should pass signingEndpoint to URLSigner', done => { + const signingEndpoint = 'https://my-endpoint.com'; + const config = { + ...SIGNED_URL_CONFIG, + signingEndpoint, + }; + + file.getSignedUrl(config, (err: Error | null) => { + assert.ifError(err); + const getSignedUrlArgs = signerGetSignedUrlStub.getCall(0).args; + assert.strictEqual( + getSignedUrlArgs[0]['signingEndpoint'], + signingEndpoint + ); + done(); + }); + }); + it('should add "x-goog-resumable: start" header if action is resumable', done => { SIGNED_URL_CONFIG.action = 'resumable'; SIGNED_URL_CONFIG.extensionHeaders = {