mirror of https://github.com/grpc/grpc-node.git
Provide the method_name for the CallCredentials callback generateMetadata
This commit is contained in:
parent
7e4c8f058c
commit
268d7eb42b
|
@ -18,6 +18,7 @@
|
|||
import { Metadata } from './metadata';
|
||||
|
||||
export interface CallMetadataOptions {
|
||||
method_name: string;
|
||||
service_url: string;
|
||||
}
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -87,6 +87,7 @@ describe('CallCredentials', () => {
|
|||
generateFromServiceURL
|
||||
);
|
||||
const metadata: Metadata = await callCredentials.generateMetadata({
|
||||
method_name: 'bar',
|
||||
service_url: 'foo',
|
||||
});
|
||||
|
||||
|
@ -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);
|
||||
}
|
||||
|
@ -139,6 +140,7 @@ describe('CallCredentials', () => {
|
|||
testCases.map(async testCase => {
|
||||
const { credentials, expected } = testCase;
|
||||
const metadata: Metadata = await credentials.generateMetadata({
|
||||
method_name: '',
|
||||
service_url: '',
|
||||
});
|
||||
|
||||
|
|
Loading…
Reference in New Issue