@grpc/grpc-js
Advanced tools
Comparing version 1.2.7 to 1.2.8
@@ -50,5 +50,12 @@ "use strict"; | ||
const resultMetadata = await metadata; | ||
resultMetadata.merge(await credsMetadata); | ||
try { | ||
resultMetadata.merge(await credsMetadata); | ||
} | ||
catch (error) { | ||
this.stream.cancelWithStatus(constants_1.Status.UNAUTHENTICATED, `Failed to retrieve auth metadata with error: ${error.message}`); | ||
return Promise.reject('Failed to retrieve auth metadata'); | ||
} | ||
if (resultMetadata.get('authorization').length > 1) { | ||
this.stream.cancelWithStatus(constants_1.Status.INTERNAL, '"authorization" metadata cannot have multiple values'); | ||
return Promise.reject('"authorization" metadata cannot have multiple values'); | ||
} | ||
@@ -55,0 +62,0 @@ return resultMetadata; |
@@ -230,3 +230,3 @@ "use strict"; | ||
// We assume the error code isn't 0 (Status.OK) | ||
callStream.cancelWithStatus(error.code || constants_1.Status.UNKNOWN, `Getting metadata from plugin failed with error: ${error.message}`); | ||
callStream.cancelWithStatus((typeof error.code === 'number') ? error.code : constants_1.Status.UNKNOWN, `Getting metadata from plugin failed with error: ${error.message}`); | ||
}); | ||
@@ -233,0 +233,0 @@ } |
{ | ||
"name": "@grpc/grpc-js", | ||
"version": "1.2.7", | ||
"version": "1.2.8", | ||
"description": "gRPC Library for Node - pure JS implementation", | ||
@@ -5,0 +5,0 @@ "homepage": "https://grpc.io/", |
@@ -24,2 +24,3 @@ /* | ||
import { splitHostPort } from './uri-parser'; | ||
import { ServiceError } from './call'; | ||
@@ -55,3 +56,11 @@ export class CallCredentialsFilter extends BaseFilter implements Filter { | ||
const resultMetadata = await metadata; | ||
resultMetadata.merge(await credsMetadata); | ||
try { | ||
resultMetadata.merge(await credsMetadata); | ||
} catch (error) { | ||
this.stream.cancelWithStatus( | ||
Status.UNAUTHENTICATED, | ||
`Failed to retrieve auth metadata with error: ${error.message}` | ||
); | ||
return Promise.reject<Metadata>('Failed to retrieve auth metadata'); | ||
} | ||
if (resultMetadata.get('authorization').length > 1) { | ||
@@ -62,2 +71,3 @@ this.stream.cancelWithStatus( | ||
); | ||
return Promise.reject<Metadata>('"authorization" metadata cannot have multiple values'); | ||
} | ||
@@ -64,0 +74,0 @@ return resultMetadata; |
@@ -387,3 +387,3 @@ /* | ||
callStream.cancelWithStatus( | ||
error.code || Status.UNKNOWN, | ||
(typeof error.code === 'number') ? error.code : Status.UNKNOWN, | ||
`Getting metadata from plugin failed with error: ${error.message}` | ||
@@ -390,0 +390,0 @@ ); |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
1122103
22472