Skip to content
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
1 change: 1 addition & 0 deletions packages/grpc-js/src/call-credentials.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
import { Metadata } from './metadata';

export interface CallMetadataOptions {
method_name: string;
service_url: string;
}

Expand Down
2 changes: 1 addition & 1 deletion packages/grpc-js/src/load-balancing-call.ts
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ export class LoadBalancingCall implements Call, DeadlineInfoProvider {
switch (pickResult.pickResultType) {
case PickResultType.COMPLETE:
this.credentials
.generateMetadata({ service_url: this.serviceUrl })
.generateMetadata({ method_name: this.methodName, service_url: this.serviceUrl })
.then(
credsMetadata => {
/* If this call was cancelled (e.g. by the deadline) before
Expand Down
4 changes: 3 additions & 1 deletion packages/grpc-js/test/test-call-credentials.ts
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@ describe('CallCredentials', () => {
generateFromServiceURL
);
const metadata: Metadata = await callCredentials.generateMetadata({
method_name: 'bar',
service_url: 'foo',
});

Expand All @@ -98,7 +99,7 @@ describe('CallCredentials', () => {
CallCredentials.createFromMetadataGenerator(generateWithError);
let metadata: Metadata | null = null;
try {
metadata = await callCredentials.generateMetadata({ service_url: '' });
metadata = await callCredentials.generateMetadata({ method_name: '', service_url: '' });
} catch (err) {
assert.ok(err instanceof Error);
}
Expand Down Expand Up @@ -139,6 +140,7 @@ describe('CallCredentials', () => {
testCases.map(async testCase => {
const { credentials, expected } = testCase;
const metadata: Metadata = await credentials.generateMetadata({
method_name: '',
service_url: '',
});

Expand Down