Skip to content

Commit

Permalink
feat: [Many APIs] update Nodejs generator to send API versions in hea…
Browse files Browse the repository at this point in the history
…ders for GAPICs (#5357)

* feat: update Nodejs generator to send API versions in headers for GAPICs

PiperOrigin-RevId: 634109303

Source-Link: googleapis/googleapis@998ade8

Source-Link: googleapis/googleapis-gen@000ca6f
Copy-Tag: eyJwIjoicGFja2FnZXMvZ29vZ2xlLWRldnRvb2xzLWFydGlmYWN0cmVnaXN0cnkvLk93bEJvdC55YW1sIiwiaCI6IjAwMGNhNmYwMDgwMWY2NWI4NDdlNjAyOWNiMDUxMTE0MDRkZjIxZWMifQ==
Copy-Tag: eyJwIjoicGFja2FnZXMvZ29vZ2xlLWRldnRvb2xzLWNsb3VkYnVpbGQvLk93bEJvdC55YW1sIiwiaCI6IjAwMGNhNmYwMDgwMWY2NWI4NDdlNjAyOWNiMDUxMTE0MDRkZjIxZWMifQ==
Copy-Tag: eyJwIjoicGFja2FnZXMvZ29vZ2xlLWRldnRvb2xzLWNsb3VkcHJvZmlsZXIvLk93bEJvdC55YW1sIiwiaCI6IjAwMGNhNmYwMDgwMWY2NWI4NDdlNjAyOWNiMDUxMTE0MDRkZjIxZWMifQ==
Copy-Tag: eyJwIjoicGFja2FnZXMvZ29vZ2xlLWRldnRvb2xzLWNvbnRhaW5lcmFuYWx5c2lzLy5Pd2xCb3QueWFtbCIsImgiOiIwMDBjYTZmMDA4MDFmNjViODQ3ZTYwMjljYjA1MTExNDA0ZGYyMWVjIn0=
Copy-Tag: eyJwIjoicGFja2FnZXMvZ29vZ2xlLWlhbS1jcmVkZW50aWFscy8uT3dsQm90LnlhbWwiLCJoIjoiMDAwY2E2ZjAwODAxZjY1Yjg0N2U2MDI5Y2IwNTExMTQwNGRmMjFlYyJ9
Copy-Tag: eyJwIjoicGFja2FnZXMvZ29vZ2xlLWlhbS8uT3dsQm90LnlhbWwiLCJoIjoiMDAwY2E2ZjAwODAxZjY1Yjg0N2U2MDI5Y2IwNTExMTQwNGRmMjFlYyJ9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repo-automation-bots/blob/main/packages/owl-bot/README.md

---------

Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com>
  • Loading branch information
gcf-owl-bot[bot] and gcf-owl-bot[bot] authored May 20, 2024
1 parent 1a2388d commit 66111e8
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 1 deletion.
2 changes: 1 addition & 1 deletion packages/google-maps-routing/src/v2/routes_client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,7 @@ export class RoutesClient {
computeRouteMatrix: new this._gaxModule.StreamDescriptor(
this._gaxModule.StreamType.SERVER_STREAMING,
!!opts.fallback,
/* gaxStreamingRetries: */ false
!!opts.gaxServerStreamingRetries
),
};

Expand Down
35 changes: 35 additions & 0 deletions packages/google-maps-routing/test/gapic_routes_v2.ts
Original file line number Diff line number Diff line change
Expand Up @@ -377,6 +377,35 @@ describe('v2.RoutesClient', () => {
assert.deepStrictEqual(response, expectedResponse);
});

it('invokes computeRouteMatrix without error and gaxServerStreamingRetries enabled', async () => {
const client = new routesModule.v2.RoutesClient({
gaxServerStreamingRetries: true,
});
client.initialize();
const request = generateSampleMessage(
new protos.google.maps.routing.v2.ComputeRouteMatrixRequest()
);
const expectedResponse = generateSampleMessage(
new protos.google.maps.routing.v2.RouteMatrixElement()
);
client.innerApiCalls.computeRouteMatrix =
stubServerStreamingCall(expectedResponse);
const stream = client.computeRouteMatrix(request);
const promise = new Promise((resolve, reject) => {
stream.on(
'data',
(response: protos.google.maps.routing.v2.RouteMatrixElement) => {
resolve(response);
}
);
stream.on('error', (err: Error) => {
reject(err);
});
});
const response = await promise;
assert.deepStrictEqual(response, expectedResponse);
});

it('invokes computeRouteMatrix with error', async () => {
const client = new routesModule.v2.RoutesClient({
credentials: {client_email: 'bogus', private_key: 'bogus'},
Expand Down Expand Up @@ -433,5 +462,11 @@ describe('v2.RoutesClient', () => {
});
await assert.rejects(promise, expectedError);
});
it('should create a client with gaxServerStreamingRetries enabled', () => {
const client = new routesModule.v2.RoutesClient({
gaxServerStreamingRetries: true,
});
assert(client);
});
});
});

0 comments on commit 66111e8

Please sign in to comment.