Skip to content

Commit

Permalink
fix conflicts
Browse files Browse the repository at this point in the history
  • Loading branch information
abmallick committed Feb 2, 2022
1 parent e0c77fb commit 909dd63
Showing 1 changed file with 0 additions and 39 deletions.
39 changes: 0 additions & 39 deletions lib/src/shared/status.dart
Original file line number Diff line number Diff line change
Expand Up @@ -400,18 +400,6 @@ void validateHttpStatusAndContentType(
// and use this information to report a better error to the application
// layer. However prefer to use status code derived from HTTP status
// if grpc-status itself does not provide an informative error.
<<<<<<< HEAD
final error = grpcErrorDetailsFromTrailers(headers);
if (error == null || error.code == StatusCode.unknown) {
throw GrpcError.custom(
status,
error?.message ??
'HTTP connection completed with ${httpStatus} instead of 200',
error?.details,
rawResponse,
error?.trailers ?? toCustomTrailers(headers),
);
=======
final error = grpcErrorFromTrailers(headers);
if (error == null || error.code == StatusCode.unknown) {
throw GrpcError.custom(
Expand All @@ -420,7 +408,6 @@ void validateHttpStatusAndContentType(
'HTTP connection completed with ${httpStatus} instead of 200',
error?.details,
rawResponse);
>>>>>>> 6c16fce (Be more resilient to broken deployments (#460))
}
throw error;
}
Expand All @@ -437,50 +424,24 @@ void validateHttpStatusAndContentType(
}
}

<<<<<<< HEAD
GrpcError? grpcErrorDetailsFromTrailers(Map<String, String> trailers) {
=======
GrpcError? grpcErrorFromTrailers(Map<String, String> trailers) {
>>>>>>> 6c16fce (Be more resilient to broken deployments (#460))
final status = trailers['grpc-status'];
final statusCode = status != null ? int.parse(status) : StatusCode.unknown;

if (statusCode != StatusCode.ok) {
final message = _tryDecodeStatusMessage(trailers['grpc-message']);
final statusDetails = trailers[_statusDetailsHeader];
return GrpcError.custom(
<<<<<<< HEAD
statusCode,
message,
statusDetails == null
? const <GeneratedMessage>[]
: decodeStatusDetails(statusDetails),
null,
toCustomTrailers(trailers),
);
=======
statusCode,
message,
statusDetails == null
? const <GeneratedMessage>[]
: decodeStatusDetails(statusDetails));
>>>>>>> 6c16fce (Be more resilient to broken deployments (#460))
}

return null;
}

<<<<<<< HEAD
Map<String, String> toCustomTrailers(Map<String, String> trailers) {
return Map.from(trailers)
..remove(':status')
..remove('content-type')
..remove('grpc-status')
..remove('grpc-message');
}

=======
>>>>>>> 6c16fce (Be more resilient to broken deployments (#460))
const _statusDetailsHeader = 'grpc-status-details-bin';

/// All accepted content-type header's prefix. We are being more permissive
Expand Down

0 comments on commit 909dd63

Please sign in to comment.