Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
const output: thrift.TProtocol = new thrift.BinaryProtocol(
writer,
)
output.writeMessageBegin(
'add',
thrift.MessageType.CALL,
1,
)
const result = new Calculator.Add__Result({
success: 89,
})
result.write(output)
output.writeMessageEnd()
const data: Buffer = writer.flush()
thrift
.appendThriftObject(meta, data, MetadataCodec)
.then((extended: Buffer) => {
socket.write(frameCodec.encode(extended))
})
})
})
}`,
)
: undefined,
sampled:
normalHeaders[ZipkinHeaders.Sampled] ===
'1',
client_id:
clientId !== undefined
? new TTwitter.ClientId(clientId)
: undefined,
contexts: [],
dest: destHeader,
delegations: [],
}
return appendThriftObject<
TTwitter.IResponseHeaderArgs
>(
requestHeader,
request.data,
TTwitter.RequestHeaderCodec,
transportType,
protocolType,
).then((extended: Buffer) => {
return next(extended, request.context).then(
(
res: IRequestResponse,
): Promise => {
return readThriftObject<
TTwitter.IResponseHeader
>(
res.body,
const output: thrift.TProtocol = new thrift.BinaryProtocol(
writer,
)
output.writeMessageBegin(
'add',
thrift.MessageType.CALL,
1,
)
const result = new Calculator.Add__Result({
success: 61,
})
result.write(output)
output.writeMessageEnd()
const data: Buffer = writer.flush()
thrift
.appendThriftObject(
responseHeader,
data,
TTwitter.ResponseHeaderCodec,
)
.then((extended: Buffer) => {
res.writeHead(200)
res.end(extended)
})
}
},
)
const output: thrift.TProtocol = new thrift.BinaryProtocol(
writer,
)
output.writeMessageBegin(
'add',
thrift.MessageType.CALL,
1,
)
const result = new Calculator.Add__Result({
success: 61,
})
result.write(output)
output.writeMessageEnd()
const data: Buffer = writer.flush()
thrift
.appendThriftObject(
responseHeader,
data,
TTwitter.ResponseHeaderCodec,
)
.then((extended: Buffer) => {
socket.write(frameCodec.encode(extended))
})
}
})
})
handler(
request: IThriftRequest,
next: NextFunction,
): Promise {
return appendThriftObject(
request.context,
request.data,
RequestCodec,
transportType,
protocolType,
).then((extended: Buffer) => {
return next(extended, request.context).then(
(response: IRequestResponse): Promise => {
return readThriftObject(
response.body,
ResponseCodec,
transportType,
protocolType,
).then(
(result: [any, Buffer]): IRequestResponse => {
return {