Skip to content
This repository has been archived by the owner on Oct 17, 2023. It is now read-only.

fix: preserve default values in x-goog-request-params header #820

Merged
merged 5 commits into from
Sep 21, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion samples/test/v3/translate_translate_text.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,6 @@ describe(REGION_TAG, () => {
const output = execSync(
`node v3/${REGION_TAG}.js ${projectId} ${location} ${text}`
);
assert.match(output, /Translation: Zdravo svijete/);
assert.match(output, /Translation: Здраво Свете/);
});
});
2 changes: 1 addition & 1 deletion samples/test/v3beta1/translate_translate_text_beta.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,6 @@ describe(REGION_TAG, () => {
const output = execSync(
`node v3beta1/${REGION_TAG}.js ${projectId} ${location} ${text}`
);
assert.match(output, /Translation: Zdravo svijete/);
assert.match(output, /Translation: Здраво Свете/);
});
});
24 changes: 12 additions & 12 deletions src/v3/translation_service_client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -591,7 +591,7 @@ export class TranslationServiceClient {
options.otherArgs.headers = options.otherArgs.headers || {};
options.otherArgs.headers['x-goog-request-params'] =
this._gaxModule.routingHeader.fromParams({
parent: request.parent || '',
parent: request.parent ?? '',
});
this.initialize();
return this.innerApiCalls.translateText(request, options, callback);
Expand Down Expand Up @@ -717,7 +717,7 @@ export class TranslationServiceClient {
options.otherArgs.headers = options.otherArgs.headers || {};
options.otherArgs.headers['x-goog-request-params'] =
this._gaxModule.routingHeader.fromParams({
parent: request.parent || '',
parent: request.parent ?? '',
});
this.initialize();
return this.innerApiCalls.detectLanguage(request, options, callback);
Expand Down Expand Up @@ -844,7 +844,7 @@ export class TranslationServiceClient {
options.otherArgs.headers = options.otherArgs.headers || {};
options.otherArgs.headers['x-goog-request-params'] =
this._gaxModule.routingHeader.fromParams({
parent: request.parent || '',
parent: request.parent ?? '',
});
this.initialize();
return this.innerApiCalls.getSupportedLanguages(request, options, callback);
Expand Down Expand Up @@ -992,7 +992,7 @@ export class TranslationServiceClient {
options.otherArgs.headers = options.otherArgs.headers || {};
options.otherArgs.headers['x-goog-request-params'] =
this._gaxModule.routingHeader.fromParams({
parent: request.parent || '',
parent: request.parent ?? '',
});
this.initialize();
return this.innerApiCalls.translateDocument(request, options, callback);
Expand Down Expand Up @@ -1078,7 +1078,7 @@ export class TranslationServiceClient {
options.otherArgs.headers = options.otherArgs.headers || {};
options.otherArgs.headers['x-goog-request-params'] =
this._gaxModule.routingHeader.fromParams({
name: request.name || '',
name: request.name ?? '',
});
this.initialize();
return this.innerApiCalls.getGlossary(request, options, callback);
Expand Down Expand Up @@ -1238,7 +1238,7 @@ export class TranslationServiceClient {
options.otherArgs.headers = options.otherArgs.headers || {};
options.otherArgs.headers['x-goog-request-params'] =
this._gaxModule.routingHeader.fromParams({
parent: request.parent || '',
parent: request.parent ?? '',
});
this.initialize();
return this.innerApiCalls.batchTranslateText(request, options, callback);
Expand Down Expand Up @@ -1435,7 +1435,7 @@ export class TranslationServiceClient {
options.otherArgs.headers = options.otherArgs.headers || {};
options.otherArgs.headers['x-goog-request-params'] =
this._gaxModule.routingHeader.fromParams({
parent: request.parent || '',
parent: request.parent ?? '',
});
this.initialize();
return this.innerApiCalls.batchTranslateDocument(
Expand Down Expand Up @@ -1580,7 +1580,7 @@ export class TranslationServiceClient {
options.otherArgs.headers = options.otherArgs.headers || {};
options.otherArgs.headers['x-goog-request-params'] =
this._gaxModule.routingHeader.fromParams({
parent: request.parent || '',
parent: request.parent ?? '',
});
this.initialize();
return this.innerApiCalls.createGlossary(request, options, callback);
Expand Down Expand Up @@ -1720,7 +1720,7 @@ export class TranslationServiceClient {
options.otherArgs.headers = options.otherArgs.headers || {};
options.otherArgs.headers['x-goog-request-params'] =
this._gaxModule.routingHeader.fromParams({
name: request.name || '',
name: request.name ?? '',
});
this.initialize();
return this.innerApiCalls.deleteGlossary(request, options, callback);
Expand Down Expand Up @@ -1875,7 +1875,7 @@ export class TranslationServiceClient {
options.otherArgs.headers = options.otherArgs.headers || {};
options.otherArgs.headers['x-goog-request-params'] =
this._gaxModule.routingHeader.fromParams({
parent: request.parent || '',
parent: request.parent ?? '',
});
this.initialize();
return this.innerApiCalls.listGlossaries(request, options, callback);
Expand Down Expand Up @@ -1934,7 +1934,7 @@ export class TranslationServiceClient {
options.otherArgs.headers = options.otherArgs.headers || {};
options.otherArgs.headers['x-goog-request-params'] =
this._gaxModule.routingHeader.fromParams({
parent: request.parent || '',
parent: request.parent ?? '',
});
const defaultCallSettings = this._defaults['listGlossaries'];
const callSettings = defaultCallSettings.merge(options);
Expand Down Expand Up @@ -2002,7 +2002,7 @@ export class TranslationServiceClient {
options.otherArgs.headers = options.otherArgs.headers || {};
options.otherArgs.headers['x-goog-request-params'] =
this._gaxModule.routingHeader.fromParams({
parent: request.parent || '',
parent: request.parent ?? '',
});
const defaultCallSettings = this._defaults['listGlossaries'];
const callSettings = defaultCallSettings.merge(options);
Expand Down
24 changes: 12 additions & 12 deletions src/v3beta1/translation_service_client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -591,7 +591,7 @@ export class TranslationServiceClient {
options.otherArgs.headers = options.otherArgs.headers || {};
options.otherArgs.headers['x-goog-request-params'] =
this._gaxModule.routingHeader.fromParams({
parent: request.parent || '',
parent: request.parent ?? '',
});
this.initialize();
return this.innerApiCalls.translateText(request, options, callback);
Expand Down Expand Up @@ -722,7 +722,7 @@ export class TranslationServiceClient {
options.otherArgs.headers = options.otherArgs.headers || {};
options.otherArgs.headers['x-goog-request-params'] =
this._gaxModule.routingHeader.fromParams({
parent: request.parent || '',
parent: request.parent ?? '',
});
this.initialize();
return this.innerApiCalls.detectLanguage(request, options, callback);
Expand Down Expand Up @@ -849,7 +849,7 @@ export class TranslationServiceClient {
options.otherArgs.headers = options.otherArgs.headers || {};
options.otherArgs.headers['x-goog-request-params'] =
this._gaxModule.routingHeader.fromParams({
parent: request.parent || '',
parent: request.parent ?? '',
});
this.initialize();
return this.innerApiCalls.getSupportedLanguages(request, options, callback);
Expand Down Expand Up @@ -1002,7 +1002,7 @@ export class TranslationServiceClient {
options.otherArgs.headers = options.otherArgs.headers || {};
options.otherArgs.headers['x-goog-request-params'] =
this._gaxModule.routingHeader.fromParams({
parent: request.parent || '',
parent: request.parent ?? '',
});
this.initialize();
return this.innerApiCalls.translateDocument(request, options, callback);
Expand Down Expand Up @@ -1094,7 +1094,7 @@ export class TranslationServiceClient {
options.otherArgs.headers = options.otherArgs.headers || {};
options.otherArgs.headers['x-goog-request-params'] =
this._gaxModule.routingHeader.fromParams({
name: request.name || '',
name: request.name ?? '',
});
this.initialize();
return this.innerApiCalls.getGlossary(request, options, callback);
Expand Down Expand Up @@ -1253,7 +1253,7 @@ export class TranslationServiceClient {
options.otherArgs.headers = options.otherArgs.headers || {};
options.otherArgs.headers['x-goog-request-params'] =
this._gaxModule.routingHeader.fromParams({
parent: request.parent || '',
parent: request.parent ?? '',
});
this.initialize();
return this.innerApiCalls.batchTranslateText(request, options, callback);
Expand Down Expand Up @@ -1450,7 +1450,7 @@ export class TranslationServiceClient {
options.otherArgs.headers = options.otherArgs.headers || {};
options.otherArgs.headers['x-goog-request-params'] =
this._gaxModule.routingHeader.fromParams({
parent: request.parent || '',
parent: request.parent ?? '',
});
this.initialize();
return this.innerApiCalls.batchTranslateDocument(
Expand Down Expand Up @@ -1595,7 +1595,7 @@ export class TranslationServiceClient {
options.otherArgs.headers = options.otherArgs.headers || {};
options.otherArgs.headers['x-goog-request-params'] =
this._gaxModule.routingHeader.fromParams({
parent: request.parent || '',
parent: request.parent ?? '',
});
this.initialize();
return this.innerApiCalls.createGlossary(request, options, callback);
Expand Down Expand Up @@ -1735,7 +1735,7 @@ export class TranslationServiceClient {
options.otherArgs.headers = options.otherArgs.headers || {};
options.otherArgs.headers['x-goog-request-params'] =
this._gaxModule.routingHeader.fromParams({
name: request.name || '',
name: request.name ?? '',
});
this.initialize();
return this.innerApiCalls.deleteGlossary(request, options, callback);
Expand Down Expand Up @@ -1890,7 +1890,7 @@ export class TranslationServiceClient {
options.otherArgs.headers = options.otherArgs.headers || {};
options.otherArgs.headers['x-goog-request-params'] =
this._gaxModule.routingHeader.fromParams({
parent: request.parent || '',
parent: request.parent ?? '',
});
this.initialize();
return this.innerApiCalls.listGlossaries(request, options, callback);
Expand Down Expand Up @@ -1949,7 +1949,7 @@ export class TranslationServiceClient {
options.otherArgs.headers = options.otherArgs.headers || {};
options.otherArgs.headers['x-goog-request-params'] =
this._gaxModule.routingHeader.fromParams({
parent: request.parent || '',
parent: request.parent ?? '',
});
const defaultCallSettings = this._defaults['listGlossaries'];
const callSettings = defaultCallSettings.merge(options);
Expand Down Expand Up @@ -2017,7 +2017,7 @@ export class TranslationServiceClient {
options.otherArgs.headers = options.otherArgs.headers || {};
options.otherArgs.headers['x-goog-request-params'] =
this._gaxModule.routingHeader.fromParams({
parent: request.parent || '',
parent: request.parent ?? '',
});
const defaultCallSettings = this._defaults['listGlossaries'];
const callSettings = defaultCallSettings.merge(options);
Expand Down
Loading