Skip to content

Commit

Permalink
Merge pull request #2793 from murgatroid99/grpc-js_server_call_get_host
Browse files Browse the repository at this point in the history
grpc-js: Add `getHost` to surface server call classes
  • Loading branch information
murgatroid99 committed Jul 12, 2024
2 parents d60f516 + ebdf52f commit e13d5e7
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions packages/grpc-js/src/server-call.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ export type ServerSurfaceCall = {
sendMetadata(responseMetadata: Metadata): void;
getDeadline(): Deadline;
getPath(): string;
getHost(): string;
} & EventEmitter;

export type ServerUnaryCall<RequestType, ResponseType> = ServerSurfaceCall & {
Expand Down Expand Up @@ -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>
Expand Down Expand Up @@ -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>
Expand Down Expand Up @@ -190,6 +199,10 @@ export class ServerWritableStreamImpl<RequestType, ResponseType>
return this.path;
}

getHost(): string {
return this.call.getHost();
}

_write(
chunk: ResponseType,
encoding: string,
Expand Down Expand Up @@ -259,6 +272,10 @@ export class ServerDuplexStreamImpl<RequestType, ResponseType>
return this.path;
}

getHost(): string {
return this.call.getHost();
}

_read(size: number) {
this.call.startRead();
}
Expand Down

0 comments on commit e13d5e7

Please sign in to comment.