diff --git a/baselines/dlp/src/v2/dlp_service_client.ts.baseline b/baselines/dlp/src/v2/dlp_service_client.ts.baseline index 09d40b2c3..e8dea7fd5 100644 --- a/baselines/dlp/src/v2/dlp_service_client.ts.baseline +++ b/baselines/dlp/src/v2/dlp_service_client.ts.baseline @@ -756,6 +756,13 @@ export class DlpServiceClient { options = optionsOrCallback as gax.CallOptions; } options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'location_id': request.locationId || '', + }); this.initialize(); return this.innerApiCalls.listInfoTypes(request, options, callback); } diff --git a/baselines/dlp/test/gapic_dlp_service_v2.ts.baseline b/baselines/dlp/test/gapic_dlp_service_v2.ts.baseline index 0b2edf0b6..6c6ddcbf9 100644 --- a/baselines/dlp/test/gapic_dlp_service_v2.ts.baseline +++ b/baselines/dlp/test/gapic_dlp_service_v2.ts.baseline @@ -509,7 +509,15 @@ describe('v2.DlpServiceClient', () => { }); client.initialize(); const request = generateSampleMessage(new protos.google.privacy.dlp.v2.ListInfoTypesRequest()); - const expectedOptions = {}; + request.locationId = ''; + const expectedHeaderRequestParams = "location_id="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; const expectedResponse = generateSampleMessage(new protos.google.privacy.dlp.v2.ListInfoTypesResponse()); client.innerApiCalls.listInfoTypes = stubSimpleCall(expectedResponse); const [response] = await client.listInfoTypes(request); @@ -525,7 +533,15 @@ describe('v2.DlpServiceClient', () => { }); client.initialize(); const request = generateSampleMessage(new protos.google.privacy.dlp.v2.ListInfoTypesRequest()); - const expectedOptions = {}; + request.locationId = ''; + const expectedHeaderRequestParams = "location_id="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; const expectedResponse = generateSampleMessage(new protos.google.privacy.dlp.v2.ListInfoTypesResponse()); client.innerApiCalls.listInfoTypes = stubSimpleCallWithCallback(expectedResponse); const promise = new Promise((resolve, reject) => { @@ -552,7 +568,15 @@ describe('v2.DlpServiceClient', () => { }); client.initialize(); const request = generateSampleMessage(new protos.google.privacy.dlp.v2.ListInfoTypesRequest()); - const expectedOptions = {}; + request.locationId = ''; + const expectedHeaderRequestParams = "location_id="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; const expectedError = new Error('expected'); client.innerApiCalls.listInfoTypes = stubSimpleCall(undefined, expectedError); await assert.rejects(async () => { await client.listInfoTypes(request); }, expectedError); diff --git a/typescript/src/schema/proto.ts b/typescript/src/schema/proto.ts index 0d1a27a82..ddbad3b10 100644 --- a/typescript/src/schema/proto.ts +++ b/typescript/src/schema/proto.ts @@ -255,7 +255,7 @@ export function getSingleHeaderParam( const message = rule.post || rule.delete || rule.get || rule.put || rule.patch; if (message) { - const res = message.match(/{(.*?)=/); + const res = message.match(/{(.*?)[=}]/); return res?.[1] ? res[1].split('.') : []; } return [];