|
|
|
@ -45,9 +45,6 @@ var testProto = grpc.load({ |
|
|
|
|
var ECHO_INITIAL_KEY = 'x-grpc-test-echo-initial'; |
|
|
|
|
var ECHO_TRAILING_KEY = 'x-grpc-test-echo-trailing-bin'; |
|
|
|
|
|
|
|
|
|
var incompressible_data = fs.readFileSync( |
|
|
|
|
__dirname + '/../../../test/cpp/interop/rnd.dat'); |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* Create a buffer filled with size zeroes |
|
|
|
|
* @param {number} size The length of the buffer |
|
|
|
@ -88,15 +85,7 @@ function getEchoTrailer(call) { |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
function getPayload(payload_type, size) { |
|
|
|
|
if (payload_type === 'RANDOM') { |
|
|
|
|
payload_type = ['COMPRESSABLE', |
|
|
|
|
'UNCOMPRESSABLE'][Math.random() < 0.5 ? 0 : 1]; |
|
|
|
|
} |
|
|
|
|
var body; |
|
|
|
|
switch (payload_type) { |
|
|
|
|
case 'COMPRESSABLE': body = zeroBuffer(size); break; |
|
|
|
|
case 'UNCOMPRESSABLE': incompressible_data.slice(size); break; |
|
|
|
|
} |
|
|
|
|
var body = zeroBuffer(size); |
|
|
|
|
return {type: payload_type, body: body}; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|