fromHttpStatus static method

RpcMetadata fromHttpStatus(
  1. int httpStatus, {
  2. String? detail,
  3. int? maxMessageLength,
})

What a caller reports for a response with HTTP status httpStatus other than 200: the status grpcStatusFromHttpStatus gives it, and the message HTTP <status> followed by detail when given.

Implementation

static RpcMetadata fromHttpStatus(
  int httpStatus, {
  String? detail,
  int? maxMessageLength,
}) => status(
  grpcStatusFromHttpStatus(httpStatus),
  message: detail == null ? 'HTTP $httpStatus' : 'HTTP $httpStatus $detail',
  maxMessageLength: maxMessageLength,
);