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;
|
||||
sendMetadata(responseMetadata: Metadata): void;
|
||||
getDeadline(): Deadline;
|
||||
getPath(): string;
|
||||
} & EventEmitter;
|
||||
|
||||
export type ServerUnaryCall<RequestType, ResponseType> = ServerSurfaceCall & {
|
||||
|
@ -127,6 +128,10 @@ export class ServerUnaryCallImpl<RequestType, ResponseType>
|
|||
getDeadline(): Deadline {
|
||||
return this.call.getDeadline();
|
||||
}
|
||||
|
||||
getPath(): string {
|
||||
return this.call.getPath();
|
||||
}
|
||||
}
|
||||
|
||||
export class ServerReadableStreamImpl<RequestType, ResponseType>
|
||||
|
@ -165,6 +170,10 @@ export class ServerReadableStreamImpl<RequestType, ResponseType>
|
|||
getDeadline(): Deadline {
|
||||
return this.call.getDeadline();
|
||||
}
|
||||
|
||||
getPath(): string {
|
||||
return this.call.getPath();
|
||||
}
|
||||
}
|
||||
|
||||
export class ServerWritableStreamImpl<RequestType, ResponseType>
|
||||
|
@ -202,6 +211,10 @@ export class ServerWritableStreamImpl<RequestType, ResponseType>
|
|||
return this.call.getDeadline();
|
||||
}
|
||||
|
||||
getPath(): string {
|
||||
return this.call.getPath();
|
||||
}
|
||||
|
||||
_write(
|
||||
chunk: ResponseType,
|
||||
encoding: string,
|
||||
|
@ -279,6 +292,10 @@ export class ServerDuplexStreamImpl<RequestType, ResponseType>
|
|||
return this.call.getDeadline();
|
||||
}
|
||||
|
||||
getPath(): string {
|
||||
return this.call.getPath();
|
||||
}
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
end(metadata?: any) {
|
||||
if (metadata) {
|
||||
|
@ -726,6 +743,8 @@ export class Http2ServerCallStream<
|
|||
call.cancelled = true;
|
||||
call.emit('cancelled', reason);
|
||||
});
|
||||
|
||||
this.once('callEnd', (status) => call.emit('callEnd', status));
|
||||
}
|
||||
|
||||
setupReadable(
|
||||
|
@ -899,6 +918,10 @@ export class Http2ServerCallStream<
|
|||
getDeadline(): Deadline {
|
||||
return this.deadline;
|
||||
}
|
||||
|
||||
getPath(): string {
|
||||
return this.handler.path;
|
||||
}
|
||||
}
|
||||
|
||||
/* eslint-disable @typescript-eslint/no-explicit-any */
|
||||
|
|
Loading…
Reference in New Issue