Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
(
req: http.IncomingMessage,
res: http.ServerResponse,
): void => {
if (count < 1) {
count += 1
const upgradeResponse: TTwitter.IUpgradeReply = {}
const writer: thrift.TTransport = new thrift.BufferedTransport()
const output: thrift.TProtocol = new thrift.BinaryProtocol(
writer,
)
output.writeMessageBegin(
'add',
thrift.MessageType.CALL,
1,
)
TTwitter.UpgradeReplyCodec.encode(
upgradeResponse,
output,
)
output.writeMessageEnd()
res.writeHead(200)
res.end(writer.flush())
} else {
output.writeMessageBegin(
'add',
thrift.MessageType.CALL,
1,
)
TTwitter.UpgradeReplyCodec.encode(
upgradeResponse,
output,
)
output.writeMessageEnd()
socket.write(frameCodec.encode(writer.flush()))
} else {
const responseHeader = new TTwitter.ResponseHeader(
{},
)
const writer: thrift.TTransport = new thrift.BufferedTransport()
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