Merge pull request #2793 from murgatroid99/grpc-js_server_call_get_host

grpc-js: Add `getHost` to surface server call classes
This commit is contained in:
Michael Lumish 2024-07-12 10:33:29 -07:00 committed by GitHub
commit e13d5e7006
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
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();
}