mirror of https://github.com/grpc/grpc-node.git
Merge pull request #2132 from ajmath/ajmath/expose-call-items
Expose path and callEnd event in ServerSurfaceCall
This commit is contained in:
commit
1a3600e2ec
|
@ -80,6 +80,7 @@ export type ServerSurfaceCall = {
|
||||||
getPeer(): string;
|
getPeer(): string;
|
||||||
sendMetadata(responseMetadata: Metadata): void;
|
sendMetadata(responseMetadata: Metadata): void;
|
||||||
getDeadline(): Deadline;
|
getDeadline(): Deadline;
|
||||||
|
getPath(): string;
|
||||||
} & EventEmitter;
|
} & EventEmitter;
|
||||||
|
|
||||||
export type ServerUnaryCall<RequestType, ResponseType> = ServerSurfaceCall & {
|
export type ServerUnaryCall<RequestType, ResponseType> = ServerSurfaceCall & {
|
||||||
|
@ -127,6 +128,10 @@ export class ServerUnaryCallImpl<RequestType, ResponseType>
|
||||||
getDeadline(): Deadline {
|
getDeadline(): Deadline {
|
||||||
return this.call.getDeadline();
|
return this.call.getDeadline();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
getPath(): string {
|
||||||
|
return this.call.getPath();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export class ServerReadableStreamImpl<RequestType, ResponseType>
|
export class ServerReadableStreamImpl<RequestType, ResponseType>
|
||||||
|
@ -165,6 +170,10 @@ export class ServerReadableStreamImpl<RequestType, ResponseType>
|
||||||
getDeadline(): Deadline {
|
getDeadline(): Deadline {
|
||||||
return this.call.getDeadline();
|
return this.call.getDeadline();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
getPath(): string {
|
||||||
|
return this.call.getPath();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export class ServerWritableStreamImpl<RequestType, ResponseType>
|
export class ServerWritableStreamImpl<RequestType, ResponseType>
|
||||||
|
@ -202,6 +211,10 @@ export class ServerWritableStreamImpl<RequestType, ResponseType>
|
||||||
return this.call.getDeadline();
|
return this.call.getDeadline();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
getPath(): string {
|
||||||
|
return this.call.getPath();
|
||||||
|
}
|
||||||
|
|
||||||
_write(
|
_write(
|
||||||
chunk: ResponseType,
|
chunk: ResponseType,
|
||||||
encoding: string,
|
encoding: string,
|
||||||
|
@ -279,6 +292,10 @@ export class ServerDuplexStreamImpl<RequestType, ResponseType>
|
||||||
return this.call.getDeadline();
|
return this.call.getDeadline();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
getPath(): string {
|
||||||
|
return this.call.getPath();
|
||||||
|
}
|
||||||
|
|
||||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||||
end(metadata?: any) {
|
end(metadata?: any) {
|
||||||
if (metadata) {
|
if (metadata) {
|
||||||
|
@ -726,6 +743,8 @@ export class Http2ServerCallStream<
|
||||||
call.cancelled = true;
|
call.cancelled = true;
|
||||||
call.emit('cancelled', reason);
|
call.emit('cancelled', reason);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
this.once('callEnd', (status) => call.emit('callEnd', status));
|
||||||
}
|
}
|
||||||
|
|
||||||
setupReadable(
|
setupReadable(
|
||||||
|
@ -899,6 +918,10 @@ export class Http2ServerCallStream<
|
||||||
getDeadline(): Deadline {
|
getDeadline(): Deadline {
|
||||||
return this.deadline;
|
return this.deadline;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
getPath(): string {
|
||||||
|
return this.handler.path;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* eslint-disable @typescript-eslint/no-explicit-any */
|
/* eslint-disable @typescript-eslint/no-explicit-any */
|
||||||
|
|
Loading…
Reference in New Issue