Skip to content

Commit a5bd765

Browse files
authored
Fix code and documentation to pass deadline metadata as a String. (grpc#1269)
- As Metadata is a <string, string> map per Closure and TS definition.
1 parent ccef7bd commit a5bd765

File tree

3 files changed

+8
-6
lines changed

3 files changed

+8
-6
lines changed

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -225,7 +225,7 @@ should be a Unix timestamp, in milliseconds.
225225
var deadline = new Date();
226226
deadline.setSeconds(deadline.getSeconds() + 1);
227227

228-
client.sayHelloAfterDelay(request, {deadline: deadline.getTime()},
228+
client.sayHelloAfterDelay(request, {deadline: deadline.getTime().toString()},
229229
(err, response) => {
230230
// err will be populated if the RPC exceeds the deadline
231231
...
@@ -318,4 +318,4 @@ Multiple proxies support the gRPC-web protocol.
318318
[gRPC]: https://grpc.io
319319
[grpc-web-docs]: https://grpc.io/docs/languages/web
320320
[gRPC-web Go Proxy]: https://github.com/improbable-eng/grpc-web/tree/master/go/grpcwebproxy
321-
[Hello World example]: net/grpc/gateway/examples/helloworld
321+
[Hello World example]: net/grpc/gateway/examples/helloworld

javascript/net/grpc/web/grpcwebclientbase_test.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -84,8 +84,8 @@ testSuite({
8484
deadline.setSeconds(deadline.getSeconds() + 1);
8585
await new Promise((resolve, reject) => {
8686
client.rpcCall(
87-
'url', new MockRequest(), {'deadline': deadline}, methodDescriptor,
88-
(error, response) => {
87+
'url', new MockRequest(), {'deadline': deadline.getTime().toString()},
88+
methodDescriptor, (error, response) => {
8989
assertNull(error);
9090
resolve();
9191
});

test/interop/interop_client.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,8 +52,10 @@ function doEmptyUnary(done) {
5252

5353
function doEmptyUnaryWithDeadline(done) {
5454
var testService = new TestServiceClient(SERVER_HOST, null, null);
55-
const deadlineMs = 1000; // 1 second
56-
testService.emptyCall(new Empty(), {deadline: Date.now() + deadlineMs},
55+
56+
const deadline = new Date();
57+
deadline.setSeconds(deadline.getSeconds() + 1);
58+
testService.emptyCall(new Empty(), {deadline: deadline.getTime().toString()},
5759
(err, response) => {
5860
assert.ifError(err);
5961
assert(response instanceof Empty);

0 commit comments

Comments
 (0)