Merge pull request #2210 from murgatroid99/grpc-js_status_decode_error_fix

grpc-js: Handle errors when decoding status details
This commit is contained in:
Michael Lumish 2022-08-29 10:42:43 -07:00 committed by GitHub
commit 77950142ff
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 2 deletions

View File

@ -1,6 +1,6 @@
{
"name": "@grpc/grpc-js",
"version": "1.6.10",
"version": "1.6.11",
"description": "gRPC Library for Node - pure JS implementation",
"homepage": "https://grpc.io/",
"repository": "https://github.com/grpc/grpc-node/tree/master/packages/grpc-js",

View File

@ -488,7 +488,11 @@ export class Http2CallStream implements Call {
}
let details = '';
if (typeof metadataMap['grpc-message'] === 'string') {
details = decodeURI(metadataMap['grpc-message']);
try {
details = decodeURI(metadataMap['grpc-message']);
} catch (e) {
details = metadataMap['grpc-messages'] as string;
}
metadata.remove('grpc-message');
this.trace(
'received status details string "' + details + '" from server'