From 6a40d72d6a41d91264366d238dafd08291eba0b7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fran=C3=A7ois?= Date: Sat, 11 Mar 2023 17:35:55 +0100 Subject: [PATCH] fix: implement abort grpc web (#785) * fix arguments order * update example --------- Co-authored-by: HERSENT --- integration/grpc-web-no-streaming-observable/example.ts | 2 +- src/generate-grpc-web.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/integration/grpc-web-no-streaming-observable/example.ts b/integration/grpc-web-no-streaming-observable/example.ts index 519bf7a2b..e0e704337 100644 --- a/integration/grpc-web-no-streaming-observable/example.ts +++ b/integration/grpc-web-no-streaming-observable/example.ts @@ -341,7 +341,7 @@ export class DashStateClientImpl implements DashState { metadata?: grpc.Metadata, abortSignal?: AbortSignal, ): Observable { - return this.rpc.unary(DashStateUserSettingsDesc, Empty.fromPartial(request), abortSignal, metadata); + return this.rpc.unary(DashStateUserSettingsDesc, Empty.fromPartial(request), metadata, abortSignal); } } diff --git a/src/generate-grpc-web.ts b/src/generate-grpc-web.ts index f78db6300..6a5ee6f62 100644 --- a/src/generate-grpc-web.ts +++ b/src/generate-grpc-web.ts @@ -76,8 +76,8 @@ function generateRpcMethod(ctx: Context, serviceDesc: ServiceDescriptorProto, me return this.rpc.${method}( ${methodDescName(serviceDesc, methodDesc)}, ${requestMessage}.fromPartial(request), - ${useAbortSignal ? "abortSignal," : ""} metadata, + ${useAbortSignal ? "abortSignal," : ""} ); } `;