grpc-js: Add getHost to surface server call classes

This commit is contained in:
Michael Lumish 2024-07-11 11:28:43 -07:00
parent f867643d8e
commit ebdf52f3f2
1 changed files with 17 additions and 0 deletions

View File

@ -37,6 +37,7 @@ export type ServerSurfaceCall = {
sendMetadata(responseMetadata: Metadata): void;
getDeadline(): Deadline;
getPath(): string;
getHost(): string;
} & EventEmitter;
export type ServerUnaryCall<RequestType, ResponseType> = ServerSurfaceCall & {
@ -109,6 +110,10 @@ export class ServerUnaryCallImpl<RequestType, ResponseType>
getPath(): string {
return this.path;
}
getHost(): string {
return this.call.getHost();
}
}
export class ServerReadableStreamImpl<RequestType, ResponseType>
@ -145,6 +150,10 @@ export class ServerReadableStreamImpl<RequestType, ResponseType>
getPath(): string {
return this.path;
}
getHost(): string {
return this.call.getHost();
}
}
export class ServerWritableStreamImpl<RequestType, ResponseType>
@ -190,6 +199,10 @@ export class ServerWritableStreamImpl<RequestType, ResponseType>
return this.path;
}
getHost(): string {
return this.call.getHost();
}
_write(
chunk: ResponseType,
encoding: string,
@ -259,6 +272,10 @@ export class ServerDuplexStreamImpl<RequestType, ResponseType>
return this.path;
}
getHost(): string {
return this.call.getHost();
}
_read(size: number) {
this.call.startRead();
}