Skip to content

Commit e13d5e7

Browse files
authored
Merge pull request #2793 from murgatroid99/grpc-js_server_call_get_host
grpc-js: Add `getHost` to surface server call classes
2 parents d60f516 + ebdf52f commit e13d5e7

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

packages/grpc-js/src/server-call.ts

+17
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ export type ServerSurfaceCall = {
3737
sendMetadata(responseMetadata: Metadata): void;
3838
getDeadline(): Deadline;
3939
getPath(): string;
40+
getHost(): string;
4041
} & EventEmitter;
4142

4243
export type ServerUnaryCall<RequestType, ResponseType> = ServerSurfaceCall & {
@@ -109,6 +110,10 @@ export class ServerUnaryCallImpl<RequestType, ResponseType>
109110
getPath(): string {
110111
return this.path;
111112
}
113+
114+
getHost(): string {
115+
return this.call.getHost();
116+
}
112117
}
113118

114119
export class ServerReadableStreamImpl<RequestType, ResponseType>
@@ -145,6 +150,10 @@ export class ServerReadableStreamImpl<RequestType, ResponseType>
145150
getPath(): string {
146151
return this.path;
147152
}
153+
154+
getHost(): string {
155+
return this.call.getHost();
156+
}
148157
}
149158

150159
export class ServerWritableStreamImpl<RequestType, ResponseType>
@@ -190,6 +199,10 @@ export class ServerWritableStreamImpl<RequestType, ResponseType>
190199
return this.path;
191200
}
192201

202+
getHost(): string {
203+
return this.call.getHost();
204+
}
205+
193206
_write(
194207
chunk: ResponseType,
195208
encoding: string,
@@ -259,6 +272,10 @@ export class ServerDuplexStreamImpl<RequestType, ResponseType>
259272
return this.path;
260273
}
261274

275+
getHost(): string {
276+
return this.call.getHost();
277+
}
278+
262279
_read(size: number) {
263280
this.call.startRead();
264281
}

0 commit comments

Comments
 (0)