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