Skip to content

Commit

Permalink
fix: call type detection util bug fix (#375)
Browse files Browse the repository at this point in the history
  • Loading branch information
ScripterSugar authored May 7, 2024
1 parent 479ef62 commit 3859690
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions lib/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,15 @@ const METHOD_PROPS = ['name', 'options', 'type', 'requestStream', 'responseStrea
'requestName', 'responseName', 'path', 'requestType', 'responseType', 'originalName']

function getCallTypeFromCall (call) {
const name = Object.getPrototypeOf(call).constructor.name
const handlerType = call && call.call && call.call.handler && call.call.handler.type

if (name.indexOf('ServerUnaryCall') === 0) {
if (handlerType === 'unary') {
return CallType.UNARY
} else if (name.indexOf('ServerWritableStream') === 0) {
} else if (handlerType === 'serverStream') {
return CallType.RESPONSE_STREAM
} else if (name.indexOf('ServerReadableStream') === 0) {
} else if (handlerType === 'clientStream') {
return CallType.REQUEST_STREAM
} else if (name.indexOf('ServerDuplexStream') === 0) {
} else if (handlerType === 'bidi') {
return CallType.DUPLEX
}
}
Expand Down

0 comments on commit 3859690

Please sign in to comment.