diff --git a/lib/utils.js b/lib/utils.js index 7ffa7b6..9593728 100644 --- a/lib/utils.js +++ b/lib/utils.js @@ -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 } }