mirror of https://github.com/grpc/grpc-web.git
Fix issue where no RPC is issued when `deadline` is specified. (#1172)
This commit is contained in:
parent
b849db4dfa
commit
cc1a135855
|
|
@ -19,3 +19,9 @@ module['exports']['GrpcWebClientBase'] = GrpcWebClientBase;
|
||||||
module['exports']['RpcError'] = RpcError;
|
module['exports']['RpcError'] = RpcError;
|
||||||
module['exports']['StatusCode'] = StatusCode;
|
module['exports']['StatusCode'] = StatusCode;
|
||||||
module['exports']['MethodType'] = MethodType;
|
module['exports']['MethodType'] = MethodType;
|
||||||
|
|
||||||
|
// Temporary hack to fix https://github.com/grpc/grpc-web/issues/1153, which is
|
||||||
|
// caused by `goog.global` not pointing to the global scope when grpc-web is
|
||||||
|
// being imported as a CommonJS module.
|
||||||
|
// TODO: Remove this hack after `goog.global` is fixed.
|
||||||
|
goog.Timer.defaultTimerObject = (typeof globalThis !== "undefined" && globalThis) || self;
|
||||||
|
|
|
||||||
|
|
@ -50,6 +50,17 @@ function doEmptyUnary(done) {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function doEmptyUnaryWithDeadline(done) {
|
||||||
|
var testService = new TestServiceClient(SERVER_HOST, null, null);
|
||||||
|
const deadlineMs = 1000; // 1 second
|
||||||
|
testService.emptyCall(new Empty(), {deadline: Date.now() + deadlineMs},
|
||||||
|
(err, response) => {
|
||||||
|
assert.ifError(err);
|
||||||
|
assert(response instanceof Empty);
|
||||||
|
done();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
function doLargeUnary(done) {
|
function doLargeUnary(done) {
|
||||||
var testService = new TestServiceClient(SERVER_HOST, null, null);
|
var testService = new TestServiceClient(SERVER_HOST, null, null);
|
||||||
var req = new SimpleRequest();
|
var req = new SimpleRequest();
|
||||||
|
|
@ -167,6 +178,7 @@ function doUnimplementedMethod(done) {
|
||||||
|
|
||||||
var testCases = {
|
var testCases = {
|
||||||
'empty_unary': {testFunc: doEmptyUnary},
|
'empty_unary': {testFunc: doEmptyUnary},
|
||||||
|
'empty_unary_with_deadline': {testFunc: doEmptyUnaryWithDeadline},
|
||||||
'large_unary': {testFunc: doLargeUnary},
|
'large_unary': {testFunc: doLargeUnary},
|
||||||
'server_streaming': {testFunc: doServerStreaming,
|
'server_streaming': {testFunc: doServerStreaming,
|
||||||
skipBinaryMode: true},
|
skipBinaryMode: true},
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue