|
|
|
@ -86,7 +86,7 @@ function emptyUnary(client, done) { |
|
|
|
|
*/ |
|
|
|
|
function largeUnary(client, done) { |
|
|
|
|
var arg = { |
|
|
|
|
response_type: testProto.PayloadType.COMPRESSABLE, |
|
|
|
|
response_type: 'COMPRESSABLE', |
|
|
|
|
response_size: 314159, |
|
|
|
|
payload: { |
|
|
|
|
body: zeroBuffer(271828) |
|
|
|
@ -94,9 +94,8 @@ function largeUnary(client, done) { |
|
|
|
|
}; |
|
|
|
|
var call = client.unaryCall(arg, function(err, resp) { |
|
|
|
|
assert.ifError(err); |
|
|
|
|
assert.strictEqual(resp.payload.type, testProto.PayloadType.COMPRESSABLE); |
|
|
|
|
assert.strictEqual(resp.payload.body.limit - resp.payload.body.offset, |
|
|
|
|
314159); |
|
|
|
|
assert.strictEqual(resp.payload.type, 'COMPRESSABLE'); |
|
|
|
|
assert.strictEqual(resp.payload.body.length, 314159); |
|
|
|
|
}); |
|
|
|
|
call.on('status', function(status) { |
|
|
|
|
assert.strictEqual(status.code, grpc.status.OK); |
|
|
|
@ -138,7 +137,7 @@ function clientStreaming(client, done) { |
|
|
|
|
*/ |
|
|
|
|
function serverStreaming(client, done) { |
|
|
|
|
var arg = { |
|
|
|
|
response_type: testProto.PayloadType.COMPRESSABLE, |
|
|
|
|
response_type: 'COMPRESSABLE', |
|
|
|
|
response_parameters: [ |
|
|
|
|
{size: 31415}, |
|
|
|
|
{size: 9}, |
|
|
|
@ -150,8 +149,8 @@ function serverStreaming(client, done) { |
|
|
|
|
var resp_index = 0; |
|
|
|
|
call.on('data', function(value) { |
|
|
|
|
assert(resp_index < 4); |
|
|
|
|
assert.strictEqual(value.payload.type, testProto.PayloadType.COMPRESSABLE); |
|
|
|
|
assert.strictEqual(value.payload.body.limit - value.payload.body.offset, |
|
|
|
|
assert.strictEqual(value.payload.type, 'COMPRESSABLE'); |
|
|
|
|
assert.strictEqual(value.payload.body.length, |
|
|
|
|
arg.response_parameters[resp_index].size); |
|
|
|
|
resp_index += 1; |
|
|
|
|
}); |
|
|
|
@ -182,23 +181,21 @@ function pingPong(client, done) { |
|
|
|
|
}); |
|
|
|
|
var index = 0; |
|
|
|
|
call.write({ |
|
|
|
|
response_type: testProto.PayloadType.COMPRESSABLE, |
|
|
|
|
response_type: 'COMPRESSABLE', |
|
|
|
|
response_parameters: [ |
|
|
|
|
{size: response_sizes[index]} |
|
|
|
|
], |
|
|
|
|
payload: {body: zeroBuffer(payload_sizes[index])} |
|
|
|
|
}); |
|
|
|
|
call.on('data', function(response) { |
|
|
|
|
assert.strictEqual(response.payload.type, |
|
|
|
|
testProto.PayloadType.COMPRESSABLE); |
|
|
|
|
assert.equal(response.payload.body.limit - response.payload.body.offset, |
|
|
|
|
response_sizes[index]); |
|
|
|
|
assert.strictEqual(response.payload.type, 'COMPRESSABLE'); |
|
|
|
|
assert.equal(response.payload.body.length, response_sizes[index]); |
|
|
|
|
index += 1; |
|
|
|
|
if (index === 4) { |
|
|
|
|
call.end(); |
|
|
|
|
} else { |
|
|
|
|
call.write({ |
|
|
|
|
response_type: testProto.PayloadType.COMPRESSABLE, |
|
|
|
|
response_type: 'COMPRESSABLE', |
|
|
|
|
response_parameters: [ |
|
|
|
|
{size: response_sizes[index]} |
|
|
|
|
], |
|
|
|
@ -251,7 +248,7 @@ function cancelAfterBegin(client, done) { |
|
|
|
|
function cancelAfterFirstResponse(client, done) { |
|
|
|
|
var call = client.fullDuplexCall(); |
|
|
|
|
call.write({ |
|
|
|
|
response_type: testProto.PayloadType.COMPRESSABLE, |
|
|
|
|
response_type: 'COMPRESSABLE', |
|
|
|
|
response_parameters: [ |
|
|
|
|
{size: 31415} |
|
|
|
|
], |
|
|
|
@ -281,7 +278,7 @@ function authTest(expected_user, client, done) { |
|
|
|
|
} |
|
|
|
|
client.updateMetadata = grpc.getGoogleAuthDelegate(credential); |
|
|
|
|
var arg = { |
|
|
|
|
response_type: testProto.PayloadType.COMPRESSABLE, |
|
|
|
|
response_type: 'COMPRESSABLE', |
|
|
|
|
response_size: 314159, |
|
|
|
|
payload: { |
|
|
|
|
body: zeroBuffer(271828) |
|
|
|
@ -291,9 +288,8 @@ function authTest(expected_user, client, done) { |
|
|
|
|
}; |
|
|
|
|
var call = client.unaryCall(arg, function(err, resp) { |
|
|
|
|
assert.ifError(err); |
|
|
|
|
assert.strictEqual(resp.payload.type, testProto.PayloadType.COMPRESSABLE); |
|
|
|
|
assert.strictEqual(resp.payload.body.limit - resp.payload.body.offset, |
|
|
|
|
314159); |
|
|
|
|
assert.strictEqual(resp.payload.type, 'COMPRESSABLE'); |
|
|
|
|
assert.strictEqual(resp.payload.body.length, 314159); |
|
|
|
|
assert.strictEqual(resp.username, expected_user); |
|
|
|
|
assert.strictEqual(resp.oauth_scope, AUTH_SCOPE_RESPONSE); |
|
|
|
|
}); |
|
|
|
|