diff --git a/packages/connect-web/src/grpc-web-transport.ts b/packages/connect-web/src/grpc-web-transport.ts index cfec08940..d3710e5e5 100644 --- a/packages/connect-web/src/grpc-web-transport.ts +++ b/packages/connect-web/src/grpc-web-transport.ts @@ -274,7 +274,6 @@ export function createGrpcWebTransport( foundStatus: boolean, trailerTarget: Headers, header: Headers, - headerError: ConnectError | undefined, signal: AbortSignal, ) { const reader = createEnvelopeReadableStream(body).getReader(); @@ -313,7 +312,6 @@ export function createGrpcWebTransport( throw "extra message"; } yield parse(data); - continue; } // Node wil not throw an AbortError on `read` if the // signal is aborted before `getReader` is called. @@ -326,9 +324,6 @@ export function createGrpcWebTransport( signal.throwIfAborted(); } if (!trailerReceived) { - if (headerError) { - throw headerError; - } throw "missing trailer"; } } @@ -382,10 +377,10 @@ export function createGrpcWebTransport( fRes.status, fRes.headers, ); + if (headerError != undefined) { + throw headerError; + } if (!fRes.body) { - if (headerError != undefined) { - throw headerError; - } throw "missing response body"; } const trailer = new Headers(); @@ -398,7 +393,6 @@ export function createGrpcWebTransport( foundStatus, trailer, fRes.headers, - headerError, req.signal, ), };