Added option to echo back user agent for testing
diff --git a/test/cpp/interop/server.cc b/test/cpp/interop/server.cc
index 63eca6a..18ac35d 100644
--- a/test/cpp/interop/server.cc
+++ b/test/cpp/interop/server.cc
@@ -82,6 +82,7 @@
 
 const char kEchoInitialMetadataKey[] = "x-grpc-test-echo-initial";
 const char kEchoTrailingBinMetadataKey[] = "x-grpc-test-echo-trailing-bin";
+const char kEchoUserAgentKey[] = "x-grpc-test-echo-useragent";
 
 void MaybeEchoMetadata(ServerContext* context) {
   const auto& client_metadata = context->client_metadata();
@@ -98,6 +99,15 @@
         kEchoTrailingBinMetadataKey,
         grpc::string(iter->second.begin(), iter->second.end()));
   }
+  // Check if client sent a magic key in the header that makes us echo
+  // back the user-agent (for testing purpose)
+  iter = client_metadata.find(kEchoUserAgentKey);
+  if (iter != client_metadata.end()) {
+    iter = client_metadata.find("user-agent");
+    if (iter != client_metadata.end()) {
+      context->AddInitialMetadata(kEchoUserAgentKey, iter->second.data());
+    }
+  }
 }
 
 bool SetPayload(PayloadType type, int size, Payload* payload) {
@@ -150,6 +160,7 @@
  public:
   Status EmptyCall(ServerContext* context, const grpc::testing::Empty* request,
                    grpc::testing::Empty* response) {
+    MaybeEchoMetadata(context);
     return Status::OK;
   }