TEST(HttpUtility, RateLimitedGrpcStatus) {
  MockStreamDecoderFilterCallbacks callbacks;

  EXPECT_CALL(callbacks, streamInfo()).Times(testing::AnyNumber());
  EXPECT_CALL(callbacks, encodeHeaders_(_, true))
      .WillOnce(Invoke([&](const ResponseHeaderMap& headers, bool) -> void {
        EXPECT_NE(headers.GrpcStatus(), nullptr);
        EXPECT_EQ(headers.getGrpcStatusValue(),
                  std::to_string(enumToInt(Grpc::Status::WellKnownGrpcStatus::Unavailable)));
      }));
  Utility::sendLocalReply(
      false, callbacks,
      Utility::LocalReplyData{true, Http::Code::TooManyRequests, "", absl::nullopt, false});

  EXPECT_CALL(callbacks, encodeHeaders_(_, true))
      .WillOnce(Invoke([&](const ResponseHeaderMap& headers, bool) -> void {
        EXPECT_NE(headers.GrpcStatus(), nullptr);
        EXPECT_EQ(headers.getGrpcStatusValue(),
                  std::to_string(enumToInt(Grpc::Status::WellKnownGrpcStatus::ResourceExhausted)));
      }));
  Utility::sendLocalReply(
      false, callbacks,
      Utility::LocalReplyData{true, Http::Code::TooManyRequests, "",
                              absl::make_optional<Grpc::Status::GrpcStatus>(
                                  Grpc::Status::WellKnownGrpcStatus::ResourceExhausted),
                              false});
}
TEST(HttpUtility, RateLimitedGrpcStatus) {
  MockStreamDecoderFilterCallbacks callbacks;

  EXPECT_CALL(callbacks, streamInfo()).Times(testing::AnyNumber());
  EXPECT_CALL(callbacks, encodeHeaders_(_, true))
      .WillOnce(Invoke([&](const ResponseHeaderMap& headers, bool) -> void {
        EXPECT_NE(headers.GrpcStatus(), nullptr);
        EXPECT_EQ(headers.getGrpcStatusValue(),
                  std::to_string(enumToInt(Grpc::Status::WellKnownGrpcStatus::Unavailable)));
      }));
  Utility::sendLocalReply(
      false, callbacks,
      Utility::LocalReplyData{true, Http::Code::TooManyRequests, "", absl::nullopt, false});

  EXPECT_CALL(callbacks, encodeHeaders_(_, true))
      .WillOnce(Invoke([&](const ResponseHeaderMap& headers, bool) -> void {
        EXPECT_NE(headers.GrpcStatus(), nullptr);
        EXPECT_EQ(headers.getGrpcStatusValue(),
                  std::to_string(enumToInt(Grpc::Status::WellKnownGrpcStatus::ResourceExhausted)));
      }));
  Utility::sendLocalReply(
      false, callbacks,
      Utility::LocalReplyData{true, Http::Code::TooManyRequests, "",
                              absl::make_optional<Grpc::Status::GrpcStatus>(
                                  Grpc::Status::WellKnownGrpcStatus::ResourceExhausted),
                              false});
}